KiCad PCB EDA Suite
connectivity_data.cpp File Reference
#include <thread>
#include <algorithm>
#include <future>
#include <connectivity/connectivity_data.h>
#include <connectivity/connectivity_algo.h>
#include <connectivity/from_to_cache.h>
#include <ratsnest/ratsnest_data.h>
#include <trigo.h>

Go to the source code of this file.

Functions

static int getMinDist (BOARD_CONNECTED_ITEM *aItem, const wxPoint &aPoint)
 

Function Documentation

◆ getMinDist()

static int getMinDist ( BOARD_CONNECTED_ITEM aItem,
const wxPoint &  aPoint 
)
static

Definition at line 590 of file connectivity_data.cpp.

591 {
592  switch( aItem->Type() )
593  {
594  case PCB_TRACE_T:
595  case PCB_ARC_T:
596  {
597  PCB_TRACK* track = static_cast<PCB_TRACK*>( aItem );
598 
599  return std::min( GetLineLength( track->GetStart(), aPoint ),
600  GetLineLength( track->GetEnd(), aPoint ) );
601  }
602 
603  default:
604  return GetLineLength( aItem->GetPosition(), aPoint );
605  }
606 }
double GetLineLength(const wxPoint &aPointA, const wxPoint &aPointB)
Return the length of a line segment defined by aPointA and aPointB.
Definition: trigo.h:222
const wxPoint & GetEnd() const
Definition: pcb_track.h:105
class PCB_ARC, an arc track segment on a copper layer
Definition: typeinfo.h:97
virtual wxPoint GetPosition() const
Definition: eda_item.h:252
class PCB_TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:95
const wxPoint & GetStart() const
Definition: pcb_track.h:108
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:113

References PCB_TRACK::GetEnd(), GetLineLength(), EDA_ITEM::GetPosition(), PCB_TRACK::GetStart(), PCB_ARC_T, PCB_TRACE_T, and EDA_ITEM::Type().

Referenced by CONNECTIVITY_DATA::TestTrackEndpointDangling().