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 &aDefaultUnits, 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 (const 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  :
41  PCB_COMPONENT( aCallbacks, 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 136 of file pcb_line.cpp.

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

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

◆ AddToFootprint()

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

Reimplemented from PCAD2KICAD::PCB_COMPONENT.

Definition at line 118 of file pcb_line.cpp.

119 {
121  {
122  FP_SHAPE* segment = new FP_SHAPE( aFootprint, SHAPE_T::SEGMENT );
123  aFootprint->Add( segment );
124 
125  segment->SetStart0( wxPoint( m_positionX, m_positionY ) );
126  segment->SetEnd0( wxPoint( m_ToX, m_ToY ) );
127 
128  segment->SetWidth( m_Width );
129  segment->SetLayer( m_KiCadLayer );
130 
131  segment->SetDrawCoord();
132  }
133 }
void SetEnd0(const wxPoint &aPoint)
Definition: fp_shape.h:114
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Definition: board_item.h:161
bool IsNonCopperLayer(LAYER_NUM aLayerId)
Test whether a layer is a non copper layer.
Definition: layer_ids.h:807
void SetWidth(int aWidth)
Definition: eda_shape.h:88
void SetDrawCoord()
Set draw coordinates (absolute values ) from relative coordinates.
Definition: fp_shape.cpp:81
void SetStart0(const wxPoint &aPoint)
Definition: fp_shape.h:111
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT) override
Removes an item from the container.
Definition: footprint.cpp:513

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

◆ Flip()

void PCAD2KICAD::PCB_LINE::Flip ( )
overridevirtual

Reimplemented from PCAD2KICAD::PCB_COMPONENT.

Definition at line 109 of file pcb_line.cpp.

110 {
112 
113  m_ToX = -m_ToX;
115 }
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 ( const wxString &  aNetName) const
inlineinherited

◆ Parse()

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

Definition at line 55 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  {
72  SetPosition( lNode->GetNodeContent(), aDefaultUnits, &m_positionX, &m_positionY,
73  aActualConversion );
74  }
75 
76  if( lNode )
77  lNode = lNode->GetNext();
78 
79  if( lNode )
80  SetPosition( lNode->GetNodeContent(), aDefaultUnits, &m_ToX, &m_ToY, aActualConversion );
81 
82  lNode = FindNode( aNode, wxT( "width" ) );
83 
84  if( lNode )
85  SetWidth( lNode->GetNodeContent(), aDefaultUnits, &m_Width, aActualConversion );
86 
87  lNode = FindNode( aNode, wxT( "netNameRef" ) );
88 
89  if( lNode )
90  {
91  lNode->GetAttribute( wxT( "Name" ), &propValue );
92  propValue.Trim( false );
93  propValue.Trim( true );
94  m_net = propValue;
96  }
97 }
void SetWidth(const wxString &aStr, const wxString &aDefaultMeasurementUnit, int *aWidth, const wxString &aActualConversion)
int GetNetCode(const wxString &aNetName) const
Definition: pcb_component.h:58
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)
void SetPosition(const wxString &aStr, const wxString &aDefaultMeasurementUnit, int *aX, int *aY, const wxString &aActualConversion)

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 100 of file pcb_line.cpp.

101 {
102  PCB_COMPONENT::SetPosOffset( aX_offs, aY_offs );
103 
104  m_ToX += aX_offs;
105  m_ToY += aY_offs;
106 }
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 63 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 67 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: