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

70 {
71  for( TRACK* seg = aStartTrace; seg; seg = seg->Next() )
72  {
73  if( seg->GetState( IS_DELETED | BUSY ) == 0 )
74  {
75  if( aPosition == seg->GetStart() )
76  {
77  if( ( aLayerMask & seg->GetLayerSet() ).any() )
78  return seg;
79  }
80 
81  if( aPosition == seg->GetEnd() )
82  {
83  if( ( aLayerMask & seg->GetLayerSet() ).any() )
84  return seg;
85  }
86  }
87 
88  if( seg == aEndTrace )
89  break;
90  }
91 
92  return NULL;
93 }
#define BUSY
Pcbnew: flag indicating that the structure has.
Definition: base_struct.h:148
#define IS_DELETED
Definition: base_struct.h:130
TRACK * Next() const
Definition: class_track.h:100
static bool ShowClearance ( PCB_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 55 of file class_track.cpp.

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

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

56 {
57  // maybe return true for tracks and vias, not for zone segments
58  return IsCopperLayer( aTrack->GetLayer() )
59  && ( aTrack->Type() == PCB_TRACE_T || aTrack->Type() == PCB_VIA_T )
61  && ( aTrack->IsDragging() || aTrack->IsMoving() || aTrack->IsNew() ) )
63  );
64 
65 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:225
bool IsMoving() const
Definition: base_struct.h:245
bool IsNew() const
Definition: base_struct.h:243
virtual PCB_LAYER_ID GetLayer() const
Function GetLayer returns the primary layer this item is on.
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:95
TRACE_CLEARANCE_DISPLAY_MODE_T m_ShowTrackClearanceMode
How trace clearances are displayed.
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:96
bool IsDragging() const
Definition: base_struct.h:246