KiCad PCB EDA Suite
RATSNEST_ITEM Class Reference

Class RATSNEST_ITEM describes a ratsnest line: a straight line connecting 2 pads. More...

#include <class_netinfo.h>

Public Member Functions

 RATSNEST_ITEM ()
 
int GetNet () const
 Function GetNet. More...
 
void SetNet (int aNetCode)
 
bool IsVisible ()
 
bool IsActive ()
 
bool IsLocal ()
 
void Draw (EDA_DRAW_PANEL *panel, wxDC *DC, GR_DRAWMODE aDrawMode, const wxPoint &offset)
 Function Draw. More...
 

Public Attributes

int m_Status
 
D_PADm_PadStart
 
D_PADm_PadEnd
 
int m_Length
 

Private Attributes

int m_NetCode
 

Detailed Description

Class RATSNEST_ITEM describes a ratsnest line: a straight line connecting 2 pads.

Definition at line 68 of file class_netinfo.h.

Constructor & Destructor Documentation

RATSNEST_ITEM::RATSNEST_ITEM ( )

Definition at line 154 of file class_netinfo_item.cpp.

References m_Length, m_NetCode, m_PadEnd, m_PadStart, and m_Status.

155 {
156  m_NetCode = 0; // netcode ( = 1.. n , 0 is the value used for not
157  // connected items)
158  m_Status = 0; // state
159  m_PadStart = NULL; // pointer to the starting pad
160  m_PadEnd = NULL; // pointer to ending pad
161  m_Length = 0; // length of the line (temporary used in some
162  // calculations)
163 }
D_PAD * m_PadEnd
Definition: class_netinfo.h:76
D_PAD * m_PadStart
Definition: class_netinfo.h:75

Member Function Documentation

void RATSNEST_ITEM::Draw ( EDA_DRAW_PANEL panel,
wxDC *  DC,
GR_DRAWMODE  aDrawMode,
const wxPoint offset 
)

Function Draw.

Function Draw Draws a line (a ratsnest) from the starting pad to the ending pad.

Definition at line 170 of file class_netinfo_item.cpp.

References g_ColorsSettings, EDA_DRAW_PANEL::GetClipBox(), COLORS_DESIGN_SETTINGS::GetItemColor(), D_PAD::GetPosition(), GRLine(), GRSetDrawMode(), m_PadEnd, m_PadStart, and RATSNEST_VISIBLE.

Referenced by PCB_BASE_FRAME::DrawGeneralRatsnest(), PCB_EDIT_FRAME::Show_1_Ratsnest(), and PCB_BASE_FRAME::TraceModuleRatsNest().

174 {
175  GRSetDrawMode( DC, aDrawMode );
176 
178 
179  GRLine( panel->GetClipBox(), DC,
180  m_PadStart->GetPosition() - aOffset,
181  m_PadEnd->GetPosition() - aOffset, 0, color );
182 }
void GRSetDrawMode(wxDC *DC, GR_DRAWMODE draw_mode)
Definition: gr_basic.cpp:290
void GRLine(EDA_RECT *ClipBox, wxDC *DC, int x1, int y1, int x2, int y2, int width, COLOR4D Color)
Definition: gr_basic.cpp:352
COLOR4D GetItemColor(int aItemIdx) const
Function GetItemColor.
D_PAD * m_PadEnd
Definition: class_netinfo.h:76
const wxPoint & GetPosition() const override
Definition: class_pad.h:170
EDA_RECT * GetClipBox()
COLORS_DESIGN_SETTINGS g_ColorsSettings
Definition: pcbnew.cpp:68
D_PAD * m_PadStart
Definition: class_netinfo.h:75
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
int RATSNEST_ITEM::GetNet ( ) const
inline

Function GetNet.

Returns
int - the net code.

Definition at line 85 of file class_netinfo.h.

References m_NetCode.

Referenced by PCB_EDIT_FRAME::Autoroute(), Autoroute_One_Track(), PCB_BASE_FRAME::DrawGeneralRatsnest(), and PCB_EDIT_FRAME::Show_1_Ratsnest().

86  {
87  return m_NetCode;
88  }
bool RATSNEST_ITEM::IsActive ( )
inline

Definition at line 100 of file class_netinfo.h.

References CH_ACTIF.

101  {
102  return (m_Status & CH_ACTIF) != 0;
103  }
#define CH_ACTIF
Definition: class_netinfo.h:60
bool RATSNEST_ITEM::IsLocal ( )
inline

Definition at line 105 of file class_netinfo.h.

References LOCAL_RATSNEST_ITEM.

106  {
107  return (m_Status & LOCAL_RATSNEST_ITEM) != 0;
108  }
#define LOCAL_RATSNEST_ITEM
Definition: class_netinfo.h:61
bool RATSNEST_ITEM::IsVisible ( )
inline

Definition at line 95 of file class_netinfo.h.

References CH_VISIBLE.

96  {
97  return (m_Status & CH_VISIBLE) != 0;
98  }
#define CH_VISIBLE
Definition: class_netinfo.h:57
void RATSNEST_ITEM::SetNet ( int  aNetCode)
inline

Definition at line 90 of file class_netinfo.h.

Referenced by MIN_SPAN_TREE_PADS::AddTreeToRatsnest(), and PCB_BASE_FRAME::build_ratsnest_module().

91  {
92  m_NetCode = aNetCode;
93  }

Member Data Documentation

int RATSNEST_ITEM::m_NetCode
private

Definition at line 71 of file class_netinfo.h.

Referenced by GetNet(), and RATSNEST_ITEM().


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