KiCad PCB EDA Suite
class_track.cpp File Reference
#include <fctsys.h>
#include <gr_basic.h>
#include <common.h>
#include <trigo.h>
#include <macros.h>
#include <class_drawpanel.h>
#include <class_pcb_screen.h>
#include <drawtxt.h>
#include <wxstruct.h>
#include <wxBasePcbFrame.h>
#include <class_board.h>
#include <class_track.h>
#include <pcbnew.h>
#include <base_units.h>
#include <msgpanel.h>
#include <bitmaps.h>

Go to the source code of this file.

Macros

#define THRESHOLD   10
 

Functions

static bool ShowClearance (DISPLAY_OPTIONS *aDisplOpts, const TRACK *aTrack)
 Function ShowClearance tests to see if the clearance border is drawn on the given track. More...
 
TRACKGetTrack (TRACK *aStartTrace, const TRACK *aEndTrace, const wxPoint &aPosition, LSET aLayerMask)
 Function GetTrack is a helper function to locate a trace segment having an end point at aPosition on aLayerMask starting at aStartTrace and end at aEndTrace. More...
 

Macro Definition Documentation

#define THRESHOLD   10

Referenced by TRACK::DrawShortNetname().

Function Documentation

TRACK* GetTrack ( TRACK aStartTrace,
const TRACK aEndTrace,
const wxPoint aPosition,
LSET  aLayerMask 
)

Function GetTrack is a helper function to locate a trace segment having an end point at aPosition on aLayerMask starting at aStartTrace and end at aEndTrace.

The segments of track that are flagged as deleted or busy are ignored. Layer visibility is also ignored.

Parameters
aStartTraceA pointer to the TRACK object to begin searching.
aEndTraceA pointer to the TRACK object to stop the search. A NULL value searches to the end of the list.
aPositionA wxPoint object containing the position to test.
aLayerMaskA layer or layers to mask the hit test. Use -1 to ignore layer mask.
Returns
A TRACK object pointer if found otherwise NULL.

Definition at line 67 of file class_track.cpp.

References BUSY, IS_DELETED, and TRACK::Next().

Referenced by BOARD::chainMarkedSegments(), PCB_EDIT_FRAME::EraseRedundantTrack(), BOARD::GetLockPoint(), and BOARD::MarkTrace().

69 {
70  for( TRACK* seg = aStartTrace; seg; seg = seg->Next() )
71  {
72  if( seg->GetState( IS_DELETED | BUSY ) == 0 )
73  {
74  if( aPosition == seg->GetStart() )
75  {
76  if( ( aLayerMask & seg->GetLayerSet() ).any() )
77  return seg;
78  }
79 
80  if( aPosition == seg->GetEnd() )
81  {
82  if( ( aLayerMask & seg->GetLayerSet() ).any() )
83  return seg;
84  }
85  }
86 
87  if( seg == aEndTrace )
88  break;
89  }
90 
91  return NULL;
92 }
#define BUSY
Pcbnew: flag indicating that the structure has.
Definition: base_struct.h:134
#define IS_DELETED
Definition: base_struct.h:116
TRACK * Next() const
Definition: class_track.h:98
static bool ShowClearance ( DISPLAY_OPTIONS aDisplOpts,
const TRACK aTrack 
)
static

Function ShowClearance tests to see if the clearance border is drawn on the given track.

Returns
bool - true if should draw clearance, else false.

Definition at line 54 of file class_track.cpp.

References BOARD_ITEM::GetLayer(), IsCopperLayer(), EDA_ITEM::IsDragging(), EDA_ITEM::IsMoving(), EDA_ITEM::IsNew(), DISPLAY_OPTIONS::m_ShowTrackClearanceMode, PCB_TRACE_T, PCB_VIA_T, SHOW_CLEARANCE_ALWAYS, SHOW_CLEARANCE_NEW_AND_EDITED_TRACKS_AND_VIA_AREAS, and EDA_ITEM::Type().

Referenced by TRACK::Draw(), and VIA::Draw().

55 {
56  // maybe return true for tracks and vias, not for zone segments
57  return IsCopperLayer( aTrack->GetLayer() )
58  && ( aTrack->Type() == PCB_TRACE_T || aTrack->Type() == PCB_VIA_T )
60  && ( aTrack->IsDragging() || aTrack->IsMoving() || aTrack->IsNew() ) )
62  );
63 
64 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:198
bool IsMoving() const
Definition: base_struct.h:218
bool IsNew() const
Definition: base_struct.h:216
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:107
TRACE_CLEARANCE_DISPLAY_MODE_T m_ShowTrackClearanceMode
How trace clearances are displayed.
Definition: pcbstruct.h:74
PCB_LAYER_ID GetLayer() const
Function GetLayer returns the primary layer this item is on.
bool IsCopperLayer(LAYER_NUM aLayerId)
Function IsCopperLayer tests whether a layer is a copper layer.
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:108
bool IsDragging() const
Definition: base_struct.h:219