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

Referenced by VIA::Draw().

#define UNDEFINED_DRILL_DIAMETER   -1

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

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

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

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

Referenced by BOARD::GetTracksByPosition().

522 {
523  while( aTrk && ( aTrk != aStopPoint ) && ( aTrk->Type() != PCB_TRACE_T ) )
524  aTrk = aTrk->Next();
525 
526  // It could stop because of the stop point, not on a via
527  if( aTrk && ( aTrk->Type() == PCB_TRACE_T ) )
528  return static_cast<TRACK*>( aTrk );
529  else
530  return NULL;
531 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:198
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:95
TRACK * Next() const
Definition: class_track.h:99
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 507 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().

508 {
509  while( aTrk && (aTrk != aStopPoint) && (aTrk->Type() != PCB_VIA_T) )
510  aTrk = aTrk->Next();
511 
512  // It could stop because of the stop point, not on a via
513  if( aTrk && (aTrk->Type() == PCB_VIA_T) )
514  return static_cast<VIA*>( aTrk );
515  else
516  return NULL;
517 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:198
TRACK * Next() const
Definition: class_track.h:99
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:132
#define IS_DELETED
Definition: base_struct.h:114
TRACK * Next() const
Definition: class_track.h:99