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 <pcb_display_options.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...
 
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

#define MIN_VIA_DRAW_SIZE   4

Definition at line 62 of file class_track.h.

Referenced by VIA::Draw().

#define UNDEFINED_DRILL_DIAMETER   -1

Definition at line 60 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 51 of file class_track.h.

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

Function Documentation

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

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

Referenced by BOARD::GetTracksByPosition().

511 {
512  while( aTrk && ( aTrk != aStopPoint ) && ( aTrk->Type() != PCB_TRACE_T ) )
513  aTrk = aTrk->Next();
514 
515  // It could stop because of the stop point, not on a via
516  if( aTrk && ( aTrk->Type() == PCB_TRACE_T ) )
517  return static_cast<TRACK*>( aTrk );
518  else
519  return NULL;
520 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:212
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:95
TRACK * Next() const
Definition: class_track.h:100
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 496 of file class_track.h.

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

497 {
498  while( aTrk && (aTrk != aStopPoint) && (aTrk->Type() != PCB_VIA_T) )
499  aTrk = aTrk->Next();
500 
501  // It could stop because of the stop point, not on a via
502  if( aTrk && (aTrk->Type() == PCB_VIA_T) )
503  return static_cast<VIA*>( aTrk );
504  else
505  return NULL;
506 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:212
TRACK * Next() const
Definition: class_track.h:100
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:96
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