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 AddToFootprint (FOOTPRINT *aFootprint) override
 
void AddToBoard () override
 
PCB_LAYER_ID GetKiCadLayer () const
 
int GetNetCode (wxString aNetName) const
 

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 39 of file pcb_line.h.

Constructor & Destructor Documentation

◆ PCB_LINE()

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

Definition at line 40 of file pcb_line.cpp.

40  : PCB_COMPONENT( aCallbacks,
41  aBoard )
42 {
43  m_Width = 0;
44  m_ToX = 0;
45  m_ToY = 0;
46  m_objType = wxT( 'L' );
47 }
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 50 of file pcb_line.cpp.

51 {
52 }

Member Function Documentation

◆ AddToBoard()

void PCAD2KICAD::PCB_LINE::AddToBoard ( )
overridevirtual

Implements PCAD2KICAD::PCB_COMPONENT.

Definition at line 137 of file pcb_line.cpp.

138 {
139  if( IsCopperLayer( m_KiCadLayer ) )
140  {
141  PCB_TRACK* track = new PCB_TRACK( m_board );
142  m_board->Add( track );
143 
144  track->SetPosition( wxPoint( m_positionX, m_positionY ) );
145  track->SetEnd( wxPoint( m_ToX, m_ToY ) );
146 
147  track->SetWidth( m_Width );
148 
149  track->SetLayer( m_KiCadLayer );
150  track->SetNetCode( m_netCode );
151  }
152  else
153  {
154  PCB_SHAPE* segment = new PCB_SHAPE( m_board );
155  m_board->Add( segment, ADD_MODE::APPEND );
156 
157  segment->SetLayer( m_KiCadLayer );
158  segment->SetStart( wxPoint( m_positionX, m_positionY ) );
159  segment->SetEnd( wxPoint( m_ToX, m_ToY ) );
160  segment->SetWidth( m_Width );
161  }
162 }
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Definition: board_item.h:192
void SetEnd(const wxPoint &aEnd)
Definition: pcb_track.h:104
bool SetNetCode(int aNetCode, bool aNoAssert)
Set net using a net code.
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT) override
Adds an item to the container.
Definition: board.cpp:606
void SetPosition(const wxPoint &aPos) override
Definition: pcb_track.h:97
void SetWidth(int aWidth)
Definition: pcb_track.h:101
void SetStart(const wxPoint &aStart)
Definition: pcb_shape.h:127
void SetWidth(int aWidth)
Definition: pcb_shape.h:96
bool IsCopperLayer(LAYER_NUM aLayerId)
Tests whether a layer is a copper layer.
void SetEnd(const wxPoint &aEnd)
Definition: pcb_shape.h:137

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, PCB_TRACK::SetEnd(), PCB_SHAPE::SetEnd(), BOARD_ITEM::SetLayer(), BOARD_CONNECTED_ITEM::SetNetCode(), PCB_TRACK::SetPosition(), PCB_SHAPE::SetStart(), PCB_SHAPE::SetWidth(), and PCB_TRACK::SetWidth().

◆ AddToFootprint()

void PCAD2KICAD::PCB_LINE::AddToFootprint ( FOOTPRINT aFootprint)
overridevirtual

Reimplemented from PCAD2KICAD::PCB_COMPONENT.

Definition at line 119 of file pcb_line.cpp.

120 {
122  {
123  FP_SHAPE* segment = new FP_SHAPE( aFootprint, PCB_SHAPE_TYPE::SEGMENT );
124  aFootprint->Add( segment );
125 
126  segment->m_Start0 = wxPoint( m_positionX, m_positionY );
127  segment->m_End0 = wxPoint( m_ToX, m_ToY );
128 
129  segment->SetWidth( m_Width );
130  segment->SetLayer( m_KiCadLayer );
131 
132  segment->SetDrawCoord();
133  }
134 }
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Definition: board_item.h:192
bool IsNonCopperLayer(LAYER_NUM aLayerId)
Test whether a layer is a non copper layer.
wxPoint m_End0
End point, relative to footprint origin, orient 0.
Definition: fp_shape.h:161
wxPoint m_Start0
Start point or center, relative to footprint origin, orient 0.
Definition: fp_shape.h:160
void SetDrawCoord()
Set draw coordinates (absolute values ) from relative coordinates.
Definition: fp_shape.cpp:82
usual segment : line with rounded ends
void SetWidth(int aWidth)
Definition: pcb_shape.h:96
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT) override
Removes an item from the container.
Definition: footprint.cpp:472

References FOOTPRINT::Add(), IsNonCopperLayer(), FP_SHAPE::m_End0, PCAD2KICAD::PCB_COMPONENT::m_KiCadLayer, PCAD2KICAD::PCB_COMPONENT::m_positionX, PCAD2KICAD::PCB_COMPONENT::m_positionY, FP_SHAPE::m_Start0, m_ToX, m_ToY, m_Width, SEGMENT, FP_SHAPE::SetDrawCoord(), BOARD_ITEM::SetLayer(), and PCB_SHAPE::SetWidth().

◆ Flip()

void PCAD2KICAD::PCB_LINE::Flip ( )
overridevirtual

Reimplemented from PCAD2KICAD::PCB_COMPONENT.

Definition at line 110 of file pcb_line.cpp.

111 {
113 
114  m_ToX = -m_ToX;
116 }
PCB_LAYER_ID FlipLayer(PCB_LAYER_ID aLayerId, int aCopperLayersCount)
Definition: lset.cpp:521

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

◆ GetKiCadLayer()

◆ GetNetCode()

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

◆ Parse()

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

Definition at line 55 of file pcb_line.cpp.

59 {
60  XNODE* lNode;
61  wxString propValue;
62 
63  m_PCadLayer = aLayer;
65  m_positionX = 0;
66  m_positionY = 0;
67  m_ToX = 0;
68  m_ToY = 0;
69  m_Width = 0;
70  lNode = FindNode( aNode, wxT( "pt" ) );
71 
72  if( lNode )
73  SetPosition( lNode->GetNodeContent(), aDefaultMeasurementUnit,
74  &m_positionX, &m_positionY, aActualConversion );
75 
76  if( lNode )
77  lNode = lNode->GetNext();
78 
79  if( lNode )
80  SetPosition( lNode->GetNodeContent(), aDefaultMeasurementUnit,
81  &m_ToX, &m_ToY, aActualConversion );
82 
83  lNode = FindNode( aNode, wxT( "width" ) );
84 
85  if( lNode )
86  SetWidth( lNode->GetNodeContent(), aDefaultMeasurementUnit, &m_Width, aActualConversion );
87 
88  lNode = FindNode( aNode, wxT( "netNameRef" ) );
89 
90  if( lNode )
91  {
92  lNode->GetAttribute( wxT( "Name" ), &propValue );
93  propValue.Trim( false );
94  propValue.Trim( true );
95  m_net = propValue;
97  }
98 }
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)
int GetNetCode(wxString aNetName) const
Definition: pcb_component.h:57
PCB_LAYER_ID GetKiCadLayer() const
Definition: pcb_component.h:56
Hold an XML or S-expression element.
Definition: xnode.h:43
XNODE * GetNext() const
Definition: xnode.h:67
XNODE * FindNode(XNODE *aChild, const wxString &aTag)

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_FOOTPRINT::DoLayerContentsObjects().

◆ SetPosOffset()

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

Reimplemented from PCAD2KICAD::PCB_COMPONENT.

Definition at line 101 of file pcb_line.cpp.

102 {
103  PCB_COMPONENT::SetPosOffset( aX_offs, aY_offs );
104 
105  m_ToX += aX_offs;
106  m_ToY += aY_offs;
107 }
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 59 of file pcb_component.h.

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

◆ m_ToX

int PCAD2KICAD::PCB_LINE::m_ToX

Definition at line 56 of file pcb_line.h.

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

◆ m_ToY

int PCAD2KICAD::PCB_LINE::m_ToY

Definition at line 57 of file pcb_line.h.

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

◆ m_uuid

KIID PCAD2KICAD::PCB_COMPONENT::m_uuid
inherited

Definition at line 63 of file pcb_component.h.

◆ m_Width

int PCAD2KICAD::PCB_LINE::m_Width

Definition at line 55 of file pcb_line.h.

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


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