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 &aDefaultUnits, const wxString &aActualConversion)
 
void AddToFootprint (FOOTPRINT *aFootprint) override
 
void AddToBoard () override
 
virtual void SetPosOffset (int aX_offs, int aY_offs)
 
virtual void Flip ()
 
PCB_LAYER_ID GetKiCadLayer () const
 
int GetNetCode (const wxString &aNetName) const
 

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 39 of file plugins/pcad/pcb_text.h.

Constructor & Destructor Documentation

◆ PCB_TEXT()

PCB_TEXT::PCB_TEXT ( PCB_CALLBACKS aCallbacks,
BOARD aBoard 
)

Definition at line 37 of file plugins/pcad/pcb_text.cpp.

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

References PCAD2KICAD::PCB_COMPONENT::m_objType.

◆ ~PCB_TEXT()

PCB_TEXT::~PCB_TEXT ( )

Definition at line 44 of file plugins/pcad/pcb_text.cpp.

45 {
46 }

Member Function Documentation

◆ AddToBoard()

void PCB_TEXT::AddToBoard ( )
overridevirtual

Implements PCAD2KICAD::PCB_COMPONENT.

Definition at line 100 of file plugins/pcad/pcb_text.cpp.

101 {
105 
106  ::PCB_TEXT* pcbtxt = new ::PCB_TEXT( m_board );
107  m_board->Add( pcbtxt, ADD_MODE::APPEND );
108 
109  pcbtxt->SetText( m_name.text );
110 
111  if( m_name.isTrueType )
113  else
115 
116  pcbtxt->SetItalic( m_name.isItalic );
118 
119  SetTextJustify( pcbtxt, m_name.justify );
120  pcbtxt->SetTextPos( wxPoint( m_name.textPositionX, m_name.textPositionY ) );
121 
122  pcbtxt->SetMirrored( m_name.mirror );
123 
124  if( pcbtxt->IsMirrored() )
125  pcbtxt->SetTextAngle( 3600.0 - m_name.textRotation );
126  else
127  pcbtxt->SetTextAngle( m_name.textRotation );
128 
129  pcbtxt->SetLayer( m_KiCadLayer );
130 }
void SetMirrored(bool isMirrored)
Definition: eda_text.h:209
bool IsMirrored() const
Definition: eda_text.h:210
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Definition: board_item.h:161
void SetTextAngle(double aAngle) override
Definition: pcb_text.cpp:104
void SetItalic(bool isItalic)
Definition: eda_text.h:200
void SetTextPos(const wxPoint &aPoint)
Definition: eda_text.h:267
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.
Definition: board.cpp:608
virtual void SetText(const wxString &aText)
Definition: eda_text.cpp:124
void SetTextJustify(EDA_TEXT *aText, TTEXT_JUSTIFY aJustify)
void SetTextThickness(int aWidth)
The TextThickness is that set by the user.
Definition: eda_text.h:180
void SetTextSizeFromStrokeFontHeight(EDA_TEXT *aText, int aTextHeight)

References BOARD::Add(), APPEND, PCAD2KICAD::TTEXTVALUE::isItalic, 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, PCAD2KICAD::SetTextJustify(), PCAD2KICAD::SetTextSizeFromStrokeFontHeight(), PCAD2KICAD::SetTextSizeFromTrueTypeFontHeight(), PCAD2KICAD::TTEXTVALUE::text, PCAD2KICAD::TTEXTVALUE::textHeight, PCAD2KICAD::TTEXTVALUE::textPositionX, PCAD2KICAD::TTEXTVALUE::textPositionY, PCAD2KICAD::TTEXTVALUE::textRotation, and PCAD2KICAD::TTEXTVALUE::textstrokeWidth.

◆ AddToFootprint()

void PCB_TEXT::AddToFootprint ( FOOTPRINT aFootprint)
overridevirtual

Reimplemented from PCAD2KICAD::PCB_COMPONENT.

Definition at line 95 of file plugins/pcad/pcb_text.cpp.

96 {
97 }

◆ Flip()

◆ GetKiCadLayer()

◆ GetNetCode()

int PCAD2KICAD::PCB_COMPONENT::GetNetCode ( const wxString &  aNetName) const
inlineinherited

◆ Parse()

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

Definition at line 49 of file plugins/pcad/pcb_text.cpp.

51 {
52  XNODE* lNode;
53  wxString str;
54 
55  m_PCadLayer = aLayer;
57  m_positionX = 0;
58  m_positionY = 0;
59  m_name.mirror = 0; // Normal, not mirrored
60  lNode = FindNode( aNode, wxT( "pt" ) );
61 
62  if( lNode )
63  {
64  SetPosition( lNode->GetNodeContent(), aDefaultUnits, &m_positionX, &m_positionY,
65  aActualConversion );
66  }
67 
68  lNode = FindNode( aNode, wxT( "rotation" ) );
69 
70  if( lNode )
71  {
72  str = lNode->GetNodeContent();
73  str.Trim( false );
74  m_rotation = StrToInt1Units( str );
75  }
76 
77  aNode->GetAttribute( wxT( "Name" ), &m_name.text );
78  m_name.text.Replace( "\r", "" );
79 
80  str = FindNodeGetContent( aNode, wxT( "justify" ) );
82 
83  str = FindNodeGetContent( aNode, wxT( "isFlipped" ) );
84 
85  if( str == wxT( "True" ) )
86  m_name.mirror = 1;
87 
88  lNode = FindNode( aNode, wxT( "textStyleRef" ) );
89 
90  if( lNode )
91  SetFontProperty( lNode, &m_name, aDefaultUnits, aActualConversion );
92 }
void SetFontProperty(XNODE *aNode, TTEXTVALUE *aTextValue, const wxString &aDefaultMeasurementUnit, const wxString &aActualConversion)
wxString FindNodeGetContent(XNODE *aChild, const wxString &aTag)
PCB_LAYER_ID GetKiCadLayer() const
Definition: pcb_component.h:56
Hold 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)
void SetPosition(const wxString &aStr, const wxString &aDefaultMeasurementUnit, int *aX, int *aY, const wxString &aActualConversion)

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.

◆ 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 63 of file pcb_component.h.

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

◆ m_uuid

KIID PCAD2KICAD::PCB_COMPONENT::m_uuid
inherited

Definition at line 67 of file pcb_component.h.


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