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 <board_connected_item.h>
#include <pcb_display_options.h>
#include <trigo.h>

Go to the source code of this file.

Classes

class  TRACK
 
class  VIA
 

Macros

#define UNDEFINED_DRILL_DIAMETER   -1
 
#define MIN_VIA_DRAW_SIZE   4
 
#define GEOMETRY_MIN_SIZE   ( int )( 0.001 * IU_PER_MM )
 

Enumerations

enum  ENDPOINT_T { ENDPOINT_START = 0, ENDPOINT_END = 1 }
 
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...
 
TRACKGetFirstTrack (TRACK *aTrk, const TRACK *aStopPoint=NULL)
 Scan a track list for the first TRACK object. Returns 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

◆ GEOMETRY_MIN_SIZE

#define GEOMETRY_MIN_SIZE   ( int )( 0.001 * IU_PER_MM )

Definition at line 71 of file class_track.h.

◆ MIN_VIA_DRAW_SIZE

#define MIN_VIA_DRAW_SIZE   4

Definition at line 68 of file class_track.h.

◆ UNDEFINED_DRILL_DIAMETER

#define UNDEFINED_DRILL_DIAMETER   -1

Definition at line 66 of file class_track.h.

Enumeration Type Documentation

◆ ENDPOINT_T

enum ENDPOINT_T
Enumerator
ENDPOINT_START 
ENDPOINT_END 

Definition at line 50 of file class_track.h.

50  {
51  ENDPOINT_START = 0,
52  ENDPOINT_END = 1
53 };

◆ VIATYPE_T

enum VIATYPE_T
Enumerator
VIA_THROUGH 
VIA_BLIND_BURIED 
VIA_MICROVIA 
VIA_NOT_DEFINED 

Definition at line 57 of file class_track.h.

58 {
59  VIA_THROUGH = 3, /* Always a through hole via */
60  VIA_BLIND_BURIED = 2, /* this via can be on internal layers */
61  VIA_MICROVIA = 1, /* this via which connect from an external layer
62  * to the near neighbor internal layer */
63  VIA_NOT_DEFINED = 0 /* not yet used */
64 };

Function Documentation

◆ GetFirstTrack()

TRACK* GetFirstTrack ( TRACK aTrk,
const TRACK aStopPoint = NULL 
)
inline

Scan a track list for the first TRACK object. Returns NULL if not found (or NULL passed)

Definition at line 504 of file class_track.h.

505 {
506  while( aTrk && ( aTrk != aStopPoint ) && ( aTrk->Type() != PCB_TRACE_T ) )
507  aTrk = aTrk->Next();
508 
509  // It could stop because of the stop point, not on a via
510  if( aTrk && ( aTrk->Type() == PCB_TRACE_T ) )
511  return static_cast<TRACK*>( aTrk );
512  else
513  return NULL;
514 }
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:95
TRACK * Next() const
Definition: class_track.h:110
KICAD_T Type() const
Function Type()
Definition: base_struct.h:204

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

Referenced by BOARD::GetTracksByPosition().

◆ GetFirstVia()

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 490 of file class_track.h.

491 {
492  while( aTrk && (aTrk != aStopPoint) && (aTrk->Type() != PCB_VIA_T) )
493  aTrk = aTrk->Next();
494 
495  // It could stop because of the stop point, not on a via
496  if( aTrk && (aTrk->Type() == PCB_VIA_T) )
497  return static_cast<VIA*>( aTrk );
498  else
499  return NULL;
500 }
TRACK * Next() const
Definition: class_track.h:110
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:96
KICAD_T Type() const
Function Type()
Definition: base_struct.h:204

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

Referenced by GENDRILL_WRITER_BASE::buildHolesList(), TRACKS_CLEANER::cleanupVias(), CreatePadsShapesSection(), TRACK::GetVia(), BOARD::GetViaByPosition(), and TRACKS_CLEANER::removeDuplicatesOfVia().

◆ GetTrack()

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.

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:117
TRACK * Next() const
Definition: class_track.h:110

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

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