KiCad PCB EDA Suite
PCAD2KICAD::PCB_PAD_SHAPE Class Reference

#include <pcb_pad_shape.h>

Inheritance diagram for PCAD2KICAD::PCB_PAD_SHAPE:
PCAD2KICAD::PCB_COMPONENT PCAD2KICAD::PCB_VIA_SHAPE

Public Member Functions

 PCB_PAD_SHAPE (PCB_CALLBACKS *aCallbacks, BOARD *aBoard)
 
 ~PCB_PAD_SHAPE ()
 
virtual void Parse (XNODE *aNode, wxString aDefaultMeasurementUnit, wxString aActualConversion)
 
void AddToBoard () override
 
virtual void SetPosOffset (int aX_offs, int aY_offs)
 
virtual void Flip ()
 
virtual void AddToModule (MODULE *aModule)
 
LAYER_ID GetKiCadLayer ()
 
int GetNewTimestamp ()
 
int GetNetCode (wxString aNetName)
 

Public Attributes

wxString m_shape
 
int m_width
 
int m_height
 
int m_tag
 
char m_objType
 
int m_PCadLayer
 
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_pad_shape.h.

Constructor & Destructor Documentation

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

Definition at line 39 of file pcb_pad_shape.cpp.

References m_height, m_shape, and m_width.

40  : PCB_COMPONENT( aCallbacks, aBoard )
41 {
42  m_shape = wxEmptyString;
43  m_width = 0;
44  m_height = 0;
45 }
PCB_COMPONENT(PCB_CALLBACKS *aCallbacks, BOARD *aBoard)
PCAD2KICAD::PCB_PAD_SHAPE::~PCB_PAD_SHAPE ( )

Definition at line 48 of file pcb_pad_shape.cpp.

49 {
50 }

Member Function Documentation

void PCAD2KICAD::PCB_PAD_SHAPE::AddToBoard ( )
overridevirtual

Implements PCAD2KICAD::PCB_COMPONENT.

Definition at line 138 of file pcb_pad_shape.cpp.

139 {
140 }
void PCAD2KICAD::PCB_COMPONENT::AddToModule ( MODULE aModule)
virtualinherited
void PCAD2KICAD::PCB_COMPONENT::Flip ( )
virtualinherited
int PCAD2KICAD::PCB_COMPONENT::GetNewTimestamp ( )
inlineinherited
void PCAD2KICAD::PCB_PAD_SHAPE::Parse ( XNODE aNode,
wxString  aDefaultMeasurementUnit,
wxString  aActualConversion 
)
virtual

Reimplemented in PCAD2KICAD::PCB_VIA_SHAPE.

Definition at line 53 of file pcb_pad_shape.cpp.

References PCAD2KICAD::FindNode(), PCAD2KICAD::PCB_COMPONENT::GetKiCadLayer(), XNODE::GetNext(), m_height, PCAD2KICAD::PCB_COMPONENT::m_KiCadLayer, PCAD2KICAD::PCB_COMPONENT::m_PCadLayer, m_shape, m_width, PCAD2KICAD::SetPosition(), and PCAD2KICAD::SetWidth().

Referenced by PCAD2KICAD::PCB_PAD::Parse().

56 {
57  wxString str, s;
58  long num;
59  int minX, maxX, minY, maxY, x, y;
60  XNODE* lNode;
61 
62  lNode = FindNode( aNode, wxT( "padShapeType" ) );
63 
64  if( lNode )
65  {
66  str = lNode->GetNodeContent();
67  str.Trim( false );
68  m_shape = str;
69  }
70 
71  lNode = FindNode( aNode, wxT( "layerNumRef" ) );
72 
73  if( lNode )
74  {
75  lNode->GetNodeContent().ToLong( &num );
76  m_PCadLayer = (int) num;
77  }
78 
80 
81  if( m_shape == wxT( "Oval" )
82  || m_shape == wxT( "Rect" )
83  || m_shape == wxT( "Ellipse" )
84  || m_shape == wxT( "MtHole" )
85  || m_shape == wxT( "RndRect" ) )
86  {
87  lNode = FindNode( aNode, wxT( "shapeWidth" ) );
88 
89  if( lNode )
90  SetWidth( lNode->GetNodeContent(), aDefaultMeasurementUnit, &m_width,
91  aActualConversion );
92 
93  lNode = FindNode( aNode, wxT( "shapeHeight" ) );
94 
95  if( lNode )
96  SetWidth(
97  lNode->GetNodeContent(), aDefaultMeasurementUnit, &m_height, aActualConversion );
98  }
99  else if( m_shape == wxT( "Polygon" ) )
100  {
101  // aproximation to simplier pad shape .....
102  lNode = FindNode( aNode, wxT( "shapeOutline" ) );
103 
104  if( lNode )
105  lNode = FindNode( lNode, wxT( "pt" ) );
106 
107  minX = 0;
108  maxX = 0;
109  minY = 0;
110  maxY = 0;
111 
112  while( lNode )
113  {
114  s = lNode->GetNodeContent();
115  SetPosition( s, aDefaultMeasurementUnit, &x, &y, aActualConversion );
116 
117  if( minX > x )
118  minX = x;
119 
120  if( maxX < x )
121  maxX = x;
122 
123  if( minY > y )
124  minY = y;
125 
126  if( maxY < y )
127  maxY = y;
128 
129  lNode = lNode->GetNext();
130  }
131 
132  m_width = maxX - minX;
133  m_height = maxY - minY;
134  }
135 }
void SetWidth(wxString aStr, wxString aDefaultMeasurementUnit, int *aWidth, wxString aActualConversion)
void SetPosition(wxString aStr, wxString aDefaultMeasurementUnit, int *aX, int *aY, 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
int PCAD2KICAD::PCB_PAD_SHAPE::m_height
wxString PCAD2KICAD::PCB_COMPONENT::m_patGraphRefName
inherited
wxString PCAD2KICAD::PCB_PAD_SHAPE::m_shape
int PCAD2KICAD::PCB_COMPONENT::m_tag
inherited

Definition at line 51 of file pcb_component.h.

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

int PCAD2KICAD::PCB_PAD_SHAPE::m_width

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