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, wxString aDefaultMeasurementUnit, 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 GetNewTimestamp ()
 
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
 
int m_timestamp
 
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

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

Definition at line 39 of file pcb_line.cpp.

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

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

Definition at line 49 of file pcb_line.cpp.

50 {
51 }

Member Function Documentation

void PCAD2KICAD::PCB_LINE::AddToBoard ( )
overridevirtual

Implements PCAD2KICAD::PCB_COMPONENT.

Definition at line 136 of file pcb_line.cpp.

References BOARD::Add(), ADD_APPEND, DLIST< T >::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, PCAD2KICAD::PCB_COMPONENT::m_timestamp, m_toX, m_toY, BOARD::m_Track, m_width, TRACK::SetEnd(), DRAWSEGMENT::SetEnd(), BOARD_ITEM::SetLayer(), BOARD_CONNECTED_ITEM::SetNetCode(), TRACK::SetPosition(), DRAWSEGMENT::SetStart(), EDA_ITEM::SetTimeStamp(), DRAWSEGMENT::SetWidth(), and TRACK::SetWidth().

137 {
138  if( IsCopperLayer( m_KiCadLayer ) )
139  {
140  TRACK* track = new TRACK( m_board );
141  m_board->m_Track.Append( track );
142 
143  track->SetTimeStamp( m_timestamp );
144 
146  track->SetEnd( wxPoint( m_toX, m_toY ) );
147 
148  track->SetWidth( m_width );
149 
150  track->SetLayer( m_KiCadLayer );
151  track->SetNetCode( m_netCode );
152  }
153  else
154  {
155  DRAWSEGMENT* dseg = new DRAWSEGMENT( m_board );
156  m_board->Add( dseg, ADD_APPEND );
157 
158  dseg->SetTimeStamp( m_timestamp );
159  dseg->SetLayer( m_KiCadLayer );
161  dseg->SetEnd( wxPoint( m_toX, m_toY ) );
162  dseg->SetWidth( m_width );
163  }
164 }
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:117
void Append(T *aNewElement)
Function Append adds aNewElement to the end of the list.
Definition: dlist.h:177
void SetTimeStamp(time_t aNewTimeStamp)
Definition: base_struct.h:217
void SetWidth(int aWidth)
Definition: class_track.h:114
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_INSERT) override
Adds an item to the container.
bool SetNetCode(int aNetCode, bool aNoAssert=false)
Function SetNetCode sets net using a net code.
void SetStart(const wxPoint &aStart)
void SetPosition(const wxPoint &aPos) override
Definition: class_track.h:111
void SetEnd(const wxPoint &aEnd)
bool IsCopperLayer(LAYER_NUM aLayerId)
Function IsCopperLayer tests whether a layer is a copper layer.
DLIST< TRACK > m_Track
Definition: class_board.h:246
void SetWidth(int aWidth)
void PCAD2KICAD::PCB_LINE::AddToModule ( MODULE aModule)
overridevirtual

Reimplemented from PCAD2KICAD::PCB_COMPONENT.

Definition at line 118 of file pcb_line.cpp.

References MODULE::GraphicalItemsList(), 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, DLIST< T >::PushBack(), S_SEGMENT, EDGE_MODULE::SetDrawCoord(), BOARD_ITEM::SetLayer(), and DRAWSEGMENT::SetWidth().

119 {
121  {
122  EDGE_MODULE* segment = new EDGE_MODULE( aModule, S_SEGMENT );
123  aModule->GraphicalItemsList().PushBack( segment );
124 
125  segment->m_Start0 = wxPoint( m_positionX, m_positionY );
126  segment->m_End0 = wxPoint( m_toX, m_toY );
127 
128  segment->SetWidth( m_width );
129  segment->SetLayer( m_KiCadLayer );
130 
131  segment->SetDrawCoord();
132  }
133 }
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
void PushBack(T *aNewElement)
Function PushBack puts aNewElement at the end of the list sequence.
Definition: dlist.h:250
void SetDrawCoord()
Set draw coordinates (absolute values ) from relative coordinates.
DLIST< BOARD_ITEM > & GraphicalItemsList()
Definition: class_module.h:137
wxPoint m_Start0
void SetWidth(int aWidth)
void PCAD2KICAD::PCB_LINE::Flip ( )
overridevirtual

Reimplemented from PCAD2KICAD::PCB_COMPONENT.

Definition at line 109 of file pcb_line.cpp.

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

110 {
112 
113  m_toX = -m_toX;
115 }
PCB_LAYER_ID FlipLayer(PCB_LAYER_ID aLayerId, int aCopperLayersCount)
Function FlippedLayerNumber.
Definition: lset.cpp:445
int PCAD2KICAD::PCB_COMPONENT::GetNetCode ( wxString  aNetName)
inlineinherited
int PCAD2KICAD::PCB_COMPONENT::GetNewTimestamp ( )
inlineinherited
void PCAD2KICAD::PCB_LINE::Parse ( XNODE aNode,
int  aLayer,
wxString  aDefaultMeasurementUnit,
wxString  aActualConversion 
)
virtual

Definition at line 54 of file pcb_line.cpp.

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

58 {
59  XNODE* lNode;
60  wxString propValue;
61 
62  m_PCadLayer = aLayer;
64  m_positionX = 0;
65  m_positionY = 0;
66  m_toX = 0;
67  m_toY = 0;
68  m_width = 0;
69  lNode = FindNode( aNode, wxT( "pt" ) );
70 
71  if( lNode )
72  SetPosition( lNode->GetNodeContent(), aDefaultMeasurementUnit,
73  &m_positionX, &m_positionY, aActualConversion );
74 
75  if( lNode )
76  lNode = lNode->GetNext();
77 
78  if( lNode )
79  SetPosition( lNode->GetNodeContent(), aDefaultMeasurementUnit,
80  &m_toX, &m_toY, aActualConversion );
81 
82  lNode = FindNode( aNode, wxT( "width" ) );
83 
84  if( lNode )
85  SetWidth( lNode->GetNodeContent(), aDefaultMeasurementUnit, &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(wxString aStr, wxString aDefaultMeasurementUnit, int *aWidth, wxString aActualConversion)
PCB_LAYER_ID GetKiCadLayer()
Definition: pcb_component.h:73
void SetPosition(wxString aStr, wxString aDefaultMeasurementUnit, int *aX, int *aY, wxString aActualConversion)
Class XNODE holds an XML or S-expression element.
Definition: xnode.h:43
XNODE * FindNode(XNODE *aChild, wxString aTag)
int GetNetCode(wxString aNetName)
Definition: pcb_component.h:75
XNODE * GetNext() const
Definition: xnode.h:68
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.

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

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)

Member Data Documentation

wxString PCAD2KICAD::PCB_COMPONENT::m_compRef
inherited
wxString PCAD2KICAD::PCB_COMPONENT::m_patGraphRefName
inherited
int PCAD2KICAD::PCB_COMPONENT::m_tag
inherited

Definition at line 51 of file pcb_component.h.

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

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

int PCAD2KICAD::PCB_LINE::m_toY

Definition at line 45 of file pcb_line.h.

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

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: