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, const wxString &aDefaultMeasurementUnit, const wxString &aActualConversion)
 
void AddToBoard () override
 
virtual void SetPosOffset (int aX_offs, int aY_offs)
 
virtual void Flip ()
 
virtual void AddToModule (MODULE *aModule)
 
PCB_LAYER_ID GetKiCadLayer ()
 
int GetNetCode (wxString aNetName)
 

Public Attributes

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

Constructor & Destructor Documentation

◆ PCB_PAD_SHAPE()

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

Definition at line 38 of file pcb_pad_shape.cpp.

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

References m_height, m_shape, and m_width.

◆ ~PCB_PAD_SHAPE()

PCAD2KICAD::PCB_PAD_SHAPE::~PCB_PAD_SHAPE ( )

Definition at line 47 of file pcb_pad_shape.cpp.

48 {
49 }

Member Function Documentation

◆ AddToBoard()

void PCAD2KICAD::PCB_PAD_SHAPE::AddToBoard ( )
overridevirtual

Implements PCAD2KICAD::PCB_COMPONENT.

Definition at line 137 of file pcb_pad_shape.cpp.

138 {
139 }

◆ AddToModule()

void PCAD2KICAD::PCB_COMPONENT::AddToModule ( MODULE aModule)
virtualinherited

◆ Flip()

◆ GetKiCadLayer()

◆ GetNetCode()

◆ Parse()

void PCAD2KICAD::PCB_PAD_SHAPE::Parse ( XNODE aNode,
const wxString &  aDefaultMeasurementUnit,
const wxString &  aActualConversion 
)
virtual

Reimplemented in PCAD2KICAD::PCB_VIA_SHAPE.

Definition at line 52 of file pcb_pad_shape.cpp.

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

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

◆ 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_height

int PCAD2KICAD::PCB_PAD_SHAPE::m_height

◆ 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_shape

wxString PCAD2KICAD::PCB_PAD_SHAPE::m_shape

◆ 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.

◆ m_width

int PCAD2KICAD::PCB_PAD_SHAPE::m_width

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