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, wxString aDefaultMeasurementUnit, 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 GetNewTimestamp ()
 
int GetNetCode (wxString aNetName)
 

Public Attributes

int m_tag
 
char m_objType
 
int m_PCadLayer
 
PCB_LAYER_ID m_KiCadLayer
 
int m_timestamp
 
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

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

Definition at line 39 of file pcb_text.cpp.

References PCAD2KICAD::PCB_COMPONENT::m_objType.

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

Definition at line 46 of file pcb_text.cpp.

47 {
48 }

Member Function Documentation

void PCAD2KICAD::PCB_TEXT::AddToBoard ( )
overridevirtual

Implements PCAD2KICAD::PCB_COMPONENT.

Definition at line 102 of file pcb_text.cpp.

References BOARD::Add(), ADD_APPEND, 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, BOARD_ITEM::SetLayer(), EDA_TEXT::SetMirrored(), EDA_TEXT::SetText(), TEXTE_PCB::SetTextAngle(), PCAD2KICAD::SetTextJustify(), EDA_TEXT::SetTextPos(), PCAD2KICAD::SetTextSizeFromStrokeFontHeight(), EDA_TEXT::SetThickness(), EDA_ITEM::SetTimeStamp(), PCAD2KICAD::_TTEXTVALUE::text, PCAD2KICAD::_TTEXTVALUE::textHeight, PCAD2KICAD::_TTEXTVALUE::textPositionX, PCAD2KICAD::_TTEXTVALUE::textPositionY, PCAD2KICAD::_TTEXTVALUE::textRotation, and PCAD2KICAD::_TTEXTVALUE::textstrokeWidth.

103 {
107 
108  TEXTE_PCB* pcbtxt = new TEXTE_PCB( m_board );
109  m_board->Add( pcbtxt, ADD_APPEND );
110 
111  pcbtxt->SetText( m_name.text );
112 
114 
116  pcbtxt->SetTextAngle( m_name.textRotation );
117 
118  SetTextJustify( pcbtxt, m_name.justify );
120  m_name.textPositionY ) );
121 
122  pcbtxt->SetMirrored( m_name.mirror );
123  pcbtxt->SetTimeStamp( 0 );
124 
125  pcbtxt->SetLayer( m_KiCadLayer );
126 }
void SetMirrored(bool isMirrored)
Definition: eda_text.h:178
void SetTextAngle(double aAngle)
virtual void SetLayer(PCB_LAYER_ID aLayer)
Function SetLayer sets the layer this item is on.
void SetTextPos(const wxPoint &aPoint)
Definition: eda_text.h:223
void SetTimeStamp(time_t aNewTimeStamp)
Definition: base_struct.h:203
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_INSERT) override
>
void SetTextJustify(EDA_TEXT *aText, TTEXT_JUSTIFY aJustify)
void SetTextSizeFromStrokeFontHeight(EDA_TEXT *aText, int aTextHeight)
void SetThickness(int aNewThickness)
Function SetThickness sets pen width.
Definition: eda_text.h:148
virtual void SetText(const wxString &aText)
Definition: eda_text.h:141
void PCAD2KICAD::PCB_TEXT::AddToModule ( MODULE aModule)
overridevirtual

Reimplemented from PCAD2KICAD::PCB_COMPONENT.

Definition at line 97 of file pcb_text.cpp.

98 {
99 }
void PCAD2KICAD::PCB_COMPONENT::Flip ( )
virtualinherited
int PCAD2KICAD::PCB_COMPONENT::GetNewTimestamp ( )
inlineinherited
void PCAD2KICAD::PCB_TEXT::Parse ( XNODE aNode,
int  aLayer,
wxString  aDefaultMeasurementUnit,
wxString  aActualConversion 
)
virtual

Definition at line 51 of file pcb_text.cpp.

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().

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

Member Data Documentation

wxString PCAD2KICAD::PCB_COMPONENT::m_compRef
inherited
wxString PCAD2KICAD::PCB_COMPONENT::m_patGraphRefName
inherited
int PCAD2KICAD::PCB_COMPONENT::m_tag
inherited

Definition at line 51 of file pcb_component.h.

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


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