KiCad PCB EDA Suite
class_track.h File Reference

Functions relatives to tracks, vias and segments used to fill zones. More...

#include <pcbnew.h>
#include <class_board_item.h>
#include <class_board_connected_item.h>
#include <PolyLine.h>
#include <trigo.h>

Go to the source code of this file.

Classes

class  TRACK
 
class  SEGZONE
 
class  VIA
 

Macros

#define UNDEFINED_DRILL_DIAMETER   -1
 
#define MIN_VIA_DRAW_SIZE   4
 

Enumerations

enum  VIATYPE_T { VIA_THROUGH = 3, VIA_BLIND_BURIED = 2, VIA_MICROVIA = 1, VIA_NOT_DEFINED = 0 }
 

Functions

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...
 
VIAGetFirstVia (TRACK *aTrk, const TRACK *aStopPoint=NULL)
 Scan a track list for the first VIA o NULL if not found (or NULL passed) More...
 

Detailed Description

Functions relatives to tracks, vias and segments used to fill zones.

Definitions for tracks, vias and zones.

Definition in file class_track.h.

Macro Definition Documentation

#define MIN_VIA_DRAW_SIZE   4

Definition at line 59 of file class_track.h.

Referenced by VIA::Draw().

#define UNDEFINED_DRILL_DIAMETER   -1

Definition at line 57 of file class_track.h.

Referenced by PCB_IO::format(), DSN::SPECCTRA_DB::makeVIA(), and VIA::SetDrillDefault().

Enumeration Type Documentation

enum VIATYPE_T
Enumerator
VIA_THROUGH 
VIA_BLIND_BURIED 
VIA_MICROVIA 
VIA_NOT_DEFINED 

Definition at line 48 of file class_track.h.

49 {
50  VIA_THROUGH = 3, /* Always a through hole via */
51  VIA_BLIND_BURIED = 2, /* this via can be on internal layers */
52  VIA_MICROVIA = 1, /* this via which connect from an external layer
53  * to the near neighbor internal layer */
54  VIA_NOT_DEFINED = 0 /* not yet used */
55 };

Function Documentation

VIA* GetFirstVia ( TRACK aTrk,
const TRACK aStopPoint = NULL 
)
inline

Scan a track list for the first VIA o NULL if not found (or NULL passed)

Definition at line 493 of file class_track.h.

References TRACK::Next(), PCB_VIA_T, and EDA_ITEM::Type().

Referenced by EXCELLON_WRITER::buildHolesList(), TRACKS_CLEANER::clean_vias(), CreatePadsShapesSection(), TRACK::GetVia(), BOARD::GetViaByPosition(), and TRACKS_CLEANER::remove_duplicates_of_via().

494 {
495  while( aTrk && (aTrk != aStopPoint) && (aTrk->Type() != PCB_VIA_T) )
496  aTrk = aTrk->Next();
497 
498  // It could stop because of the stop point, not on a via
499  if( aTrk && (aTrk->Type() == PCB_VIA_T) )
500  return static_cast<VIA*>( aTrk );
501  else
502  return NULL;
503 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:198
TRACK * Next() const
Definition: class_track.h:97
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:108
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(), BOARD::MarkTrace(), and CONNECTIONS::SearchConnectedTracks().

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:134
#define IS_DELETED
Definition: base_struct.h:116
TRACK * Next() const
Definition: class_track.h:97