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

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 37 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 35 of file pcb_pad_shape.cpp.

35  :
36  PCB_COMPONENT( aCallbacks, aBoard )
37 {
38  m_Shape = wxEmptyString;
39  m_Width = 0;
40  m_Height = 0;
41 }
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 44 of file pcb_pad_shape.cpp.

45 {
46 }

Member Function Documentation

◆ AddToBoard()

void PCAD2KICAD::PCB_PAD_SHAPE::AddToBoard ( )
overridevirtual

Implements PCAD2KICAD::PCB_COMPONENT.

Definition at line 131 of file pcb_pad_shape.cpp.

132 {
133 }

◆ AddToFootprint()

void PCAD2KICAD::PCB_COMPONENT::AddToFootprint ( FOOTPRINT aFootprint)
virtualinherited

◆ Flip()

◆ GetKiCadLayer()

◆ GetNetCode()

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

◆ Parse()

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

Reimplemented in PCAD2KICAD::PCB_VIA_SHAPE.

Definition at line 49 of file pcb_pad_shape.cpp.

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

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

◆ m_Width

int PCAD2KICAD::PCB_PAD_SHAPE::m_Width

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