KiCad PCB EDA Suite
PCAD2KICAD::PCB_LINE Class Reference

#include <pcb_line.h>

Inheritance diagram for PCAD2KICAD::PCB_LINE:
PCAD2KICAD::PCB_COMPONENT

Public Member Functions

 PCB_LINE (PCB_CALLBACKS *aCallbacks, BOARD *aBoard)
 
 ~PCB_LINE ()
 
virtual void Parse (XNODE *aNode, int aLayer, const wxString &aDefaultMeasurementUnit, const wxString &aActualConversion)
 
virtual void SetPosOffset (int aX_offs, int aY_offs) override
 
virtual void Flip () override
 
void AddToModule (MODULE *aModule) override
 
void AddToBoard () override
 
PCB_LAYER_ID GetKiCadLayer ()
 
int GetNetCode (wxString aNetName)
 

Public Attributes

int m_width
 
int m_toX
 
int m_toY
 
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_line.h.

Constructor & Destructor Documentation

◆ PCB_LINE()

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

Definition at line 38 of file pcb_line.cpp.

38  : PCB_COMPONENT( aCallbacks,
39  aBoard )
40 {
41  m_width = 0;
42  m_toX = 0;
43  m_toY = 0;
44  m_objType = wxT( 'L' );
45 }
PCB_COMPONENT(PCB_CALLBACKS *aCallbacks, BOARD *aBoard)

References PCAD2KICAD::PCB_COMPONENT::m_objType, m_toX, m_toY, and m_width.

◆ ~PCB_LINE()

PCAD2KICAD::PCB_LINE::~PCB_LINE ( )

Definition at line 48 of file pcb_line.cpp.

49 {
50 }

Member Function Documentation

◆ AddToBoard()

void PCAD2KICAD::PCB_LINE::AddToBoard ( )
overridevirtual

Implements PCAD2KICAD::PCB_COMPONENT.

Definition at line 135 of file pcb_line.cpp.

136 {
137  if( IsCopperLayer( m_KiCadLayer ) )
138  {
139  TRACK* track = new TRACK( m_board );
140  m_board->Add( track );
141 
143  track->SetEnd( wxPoint( m_toX, m_toY ) );
144 
145  track->SetWidth( m_width );
146 
147  track->SetLayer( m_KiCadLayer );
148  track->SetNetCode( m_netCode );
149  }
150  else
151  {
152  DRAWSEGMENT* dseg = new DRAWSEGMENT( m_board );
153  m_board->Add( dseg, ADD_MODE::APPEND );
154 
155  dseg->SetLayer( m_KiCadLayer );
157  dseg->SetEnd( wxPoint( m_toX, m_toY ) );
158  dseg->SetWidth( m_width );
159  }
160 }
virtual void SetLayer(PCB_LAYER_ID aLayer)
Function SetLayer sets the layer this item is on.
void SetEnd(const wxPoint &aEnd)
Definition: class_track.h:114
bool SetNetCode(int aNetCode, bool aNoAssert)
Sets net using a net code.
void SetWidth(int aWidth)
Definition: class_track.h:111
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT) override
Adds an item to the container.
void SetStart(const wxPoint &aStart)
void SetPosition(const wxPoint &aPos) override
Definition: class_track.h:107
void SetEnd(const wxPoint &aEnd)
bool IsCopperLayer(LAYER_NUM aLayerId)
Function IsCopperLayer tests whether a layer is a copper layer.
void SetWidth(int aWidth)

References BOARD::Add(), APPEND, IsCopperLayer(), PCAD2KICAD::PCB_COMPONENT::m_board, PCAD2KICAD::PCB_COMPONENT::m_KiCadLayer, PCAD2KICAD::PCB_COMPONENT::m_netCode, PCAD2KICAD::PCB_COMPONENT::m_positionX, PCAD2KICAD::PCB_COMPONENT::m_positionY, m_toX, m_toY, m_width, TRACK::SetEnd(), DRAWSEGMENT::SetEnd(), BOARD_ITEM::SetLayer(), BOARD_CONNECTED_ITEM::SetNetCode(), TRACK::SetPosition(), DRAWSEGMENT::SetStart(), DRAWSEGMENT::SetWidth(), and TRACK::SetWidth().

◆ AddToModule()

void PCAD2KICAD::PCB_LINE::AddToModule ( MODULE aModule)
overridevirtual

Reimplemented from PCAD2KICAD::PCB_COMPONENT.

Definition at line 117 of file pcb_line.cpp.

118 {
120  {
121  EDGE_MODULE* segment = new EDGE_MODULE( aModule, S_SEGMENT );
122  aModule->Add( segment );
123 
124  segment->m_Start0 = wxPoint( m_positionX, m_positionY );
125  segment->m_End0 = wxPoint( m_toX, m_toY );
126 
127  segment->SetWidth( m_width );
128  segment->SetLayer( m_KiCadLayer );
129 
130  segment->SetDrawCoord();
131  }
132 }
virtual void SetLayer(PCB_LAYER_ID aLayer)
Function SetLayer sets the layer this item is on.
usual segment : line with rounded ends
bool IsNonCopperLayer(LAYER_NUM aLayerId)
Function IsNonCopperLayer tests whether a layer is a non copper layer.
wxPoint m_End0
End point, relative to module origin, orient 0.
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT) override
void SetDrawCoord()
Set draw coordinates (absolute values ) from relative coordinates.
wxPoint m_Start0
Start point or center, relative to module origin, orient 0.
void SetWidth(int aWidth)

References MODULE::Add(), IsNonCopperLayer(), EDGE_MODULE::m_End0, PCAD2KICAD::PCB_COMPONENT::m_KiCadLayer, PCAD2KICAD::PCB_COMPONENT::m_positionX, PCAD2KICAD::PCB_COMPONENT::m_positionY, EDGE_MODULE::m_Start0, m_toX, m_toY, m_width, S_SEGMENT, EDGE_MODULE::SetDrawCoord(), BOARD_ITEM::SetLayer(), and DRAWSEGMENT::SetWidth().

◆ Flip()

void PCAD2KICAD::PCB_LINE::Flip ( )
overridevirtual

Reimplemented from PCAD2KICAD::PCB_COMPONENT.

Definition at line 108 of file pcb_line.cpp.

109 {
111 
112  m_toX = -m_toX;
114 }
PCB_LAYER_ID FlipLayer(PCB_LAYER_ID aLayerId, int aCopperLayersCount)
Function FlippedLayerNumber.
Definition: lset.cpp:485

References PCAD2KICAD::PCB_COMPONENT::Flip(), FlipLayer(), PCAD2KICAD::PCB_COMPONENT::m_KiCadLayer, and m_toX.

◆ GetKiCadLayer()

◆ GetNetCode()

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

◆ Parse()

void PCAD2KICAD::PCB_LINE::Parse ( XNODE aNode,
int  aLayer,
const wxString &  aDefaultMeasurementUnit,
const wxString &  aActualConversion 
)
virtual

Definition at line 53 of file pcb_line.cpp.

57 {
58  XNODE* lNode;
59  wxString propValue;
60 
61  m_PCadLayer = aLayer;
63  m_positionX = 0;
64  m_positionY = 0;
65  m_toX = 0;
66  m_toY = 0;
67  m_width = 0;
68  lNode = FindNode( aNode, wxT( "pt" ) );
69 
70  if( lNode )
71  SetPosition( lNode->GetNodeContent(), aDefaultMeasurementUnit,
72  &m_positionX, &m_positionY, aActualConversion );
73 
74  if( lNode )
75  lNode = lNode->GetNext();
76 
77  if( lNode )
78  SetPosition( lNode->GetNodeContent(), aDefaultMeasurementUnit,
79  &m_toX, &m_toY, aActualConversion );
80 
81  lNode = FindNode( aNode, wxT( "width" ) );
82 
83  if( lNode )
84  SetWidth( lNode->GetNodeContent(), aDefaultMeasurementUnit, &m_width, aActualConversion );
85 
86  lNode = FindNode( aNode, wxT( "netNameRef" ) );
87 
88  if( lNode )
89  {
90  lNode->GetAttribute( wxT( "Name" ), &propValue );
91  propValue.Trim( false );
92  propValue.Trim( true );
93  m_net = propValue;
95  }
96 }
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 * GetNext() const
Definition: xnode.h:68
XNODE * FindNode(XNODE *aChild, const wxString &aTag)
int GetNetCode(wxString aNetName)
Definition: pcb_component.h:74

References PCAD2KICAD::FindNode(), PCAD2KICAD::PCB_COMPONENT::GetKiCadLayer(), PCAD2KICAD::PCB_COMPONENT::GetNetCode(), XNODE::GetNext(), PCAD2KICAD::PCB_COMPONENT::m_KiCadLayer, PCAD2KICAD::PCB_COMPONENT::m_net, PCAD2KICAD::PCB_COMPONENT::m_netCode, PCAD2KICAD::PCB_COMPONENT::m_PCadLayer, PCAD2KICAD::PCB_COMPONENT::m_positionX, PCAD2KICAD::PCB_COMPONENT::m_positionY, m_toX, m_toY, m_width, PCAD2KICAD::SetPosition(), and PCAD2KICAD::SetWidth().

Referenced by PCAD2KICAD::PCB_MODULE::DoLayerContentsObjects().

◆ SetPosOffset()

void PCAD2KICAD::PCB_LINE::SetPosOffset ( int  aX_offs,
int  aY_offs 
)
overridevirtual

Reimplemented from PCAD2KICAD::PCB_COMPONENT.

Definition at line 99 of file pcb_line.cpp.

100 {
101  PCB_COMPONENT::SetPosOffset( aX_offs, aY_offs );
102 
103  m_toX += aX_offs;
104  m_toY += aY_offs;
105 }
virtual void SetPosOffset(int aX_offs, int aY_offs)

References m_toX, m_toY, and PCAD2KICAD::PCB_COMPONENT::SetPosOffset().

Member Data Documentation

◆ m_board

◆ m_callbacks

◆ m_compRef

wxString PCAD2KICAD::PCB_COMPONENT::m_compRef
inherited

◆ 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_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_toX

int PCAD2KICAD::PCB_LINE::m_toX

Definition at line 44 of file pcb_line.h.

Referenced by AddToBoard(), AddToModule(), Flip(), Parse(), PCB_LINE(), and SetPosOffset().

◆ m_toY

int PCAD2KICAD::PCB_LINE::m_toY

Definition at line 45 of file pcb_line.h.

Referenced by AddToBoard(), AddToModule(), Parse(), PCB_LINE(), and SetPosOffset().

◆ m_uuid

KIID PCAD2KICAD::PCB_COMPONENT::m_uuid
inherited

Definition at line 55 of file pcb_component.h.

◆ m_width

int PCAD2KICAD::PCB_LINE::m_width

Definition at line 43 of file pcb_line.h.

Referenced by AddToBoard(), AddToModule(), Parse(), and PCB_LINE().


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