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 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::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, 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(), 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 
113  if( m_name.isTrueType )
115  else
117 
118  pcbtxt->SetItalic( m_name.isItalic );
120  pcbtxt->SetTextAngle( m_name.textRotation );
121 
122  SetTextJustify( pcbtxt, m_name.justify );
124  m_name.textPositionY ) );
125 
126  pcbtxt->SetMirrored( m_name.mirror );
127  pcbtxt->SetTimeStamp( 0 );
128 
129  pcbtxt->SetLayer( m_KiCadLayer );
130 }
void SetMirrored(bool isMirrored)
Definition: eda_text.h:176
void SetTextAngle(double aAngle)
virtual void SetLayer(PCB_LAYER_ID aLayer)
Function SetLayer sets the layer this item is on.
void SetItalic(bool isItalic)
Definition: eda_text.h:167
void SetTextPos(const wxPoint &aPoint)
Definition: eda_text.h:221
void SetTextSizeFromTrueTypeFontHeight(EDA_TEXT *aText, int aTextHeight)
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_INSERT) override
Adds an item to the container.
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:146
void SetTimeStamp(timestamp_t aNewTimeStamp)
Definition: base_struct.h:203
virtual void SetText(const wxString &aText)
Definition: eda_text.h:139
void PCAD2KICAD::PCB_TEXT::AddToModule ( MODULE aModule)
overridevirtual

Reimplemented from PCAD2KICAD::PCB_COMPONENT.

Definition at line 97 of file pcb_text.cpp.

98 {
99 }
int PCAD2KICAD::PCB_COMPONENT::GetNewTimestamp ( )
inlineinherited
void PCAD2KICAD::PCB_TEXT::Parse ( XNODE aNode,
int  aLayer,
const wxString &  aDefaultMeasurementUnit,
const 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(), str, 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 }
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)
const string & str
Definition: json11.cpp:596
PCB_LAYER_ID GetKiCadLayer()
Definition: pcb_component.h:73
wxString FindNodeGetContent(XNODE *aChild, const wxString &aTag)
Class 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)
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: