KiCad PCB EDA Suite
PNS::ROUTER Class Reference

#include <pns_router.h>

Public Types

enum  RouterState { IDLE, DRAG_SEGMENT, ROUTE_TRACK }
 

Public Member Functions

 ROUTER ()
 
 ~ROUTER ()
 
void SetInterface (ROUTER_IFACE *aIface)
 
void SetMode (ROUTER_MODE aMode)
 
ROUTER_MODE Mode () const
 
RouterState GetState () const
 
DRAG_ALGOGetDragger ()
 
void ClearWorld ()
 
void SyncWorld ()
 
bool RoutingInProgress () const
 
bool StartRouting (const VECTOR2I &aP, ITEM *aItem, int aLayer)
 
void Move (const VECTOR2I &aP, ITEM *aItem)
 
bool FixRoute (const VECTOR2I &aP, ITEM *aItem, bool aForceFinish=false)
 
void BreakSegment (ITEM *aItem, const VECTOR2I &aP)
 
void UndoLastSegment ()
 
void CommitRouting ()
 
void StopRouting ()
 
void ClearViewDecorations ()
 
NODEGetWorld () const
 
void FlipPosture ()
 
bool SwitchLayer (int layer)
 
void ToggleViaPlacement ()
 
void SetOrthoMode (bool aEnable)
 
void ToggleRounded ()
 
int GetCurrentLayer () const
 
const std::vector< int > GetCurrentNets () const
 
LOGGERLogger ()
 
RULE_RESOLVERGetRuleResolver () const
 
bool IsPlacingVia () const
 
const ITEM_SET QueryHoverItems (const VECTOR2I &aP)
 
bool StartDragging (const VECTOR2I &aP, ITEM *aItem, int aDragMode=DM_ANY)
 
bool StartDragging (const VECTOR2I &aP, ITEM_SET aItems, int aDragMode=DM_COMPONENT)
 
void SetIterLimit (int aX)
 
int GetIterLimit () const
 
ROUTING_SETTINGSSettings ()
 
void CommitRouting (NODE *aNode)
 
void UpdateSizes (const SIZES_SETTINGS &aSizes)
 Applies stored settings. More...
 
void LoadSettings (ROUTING_SETTINGS *aSettings)
 Changes routing settings to ones passed in the parameter. More...
 
SIZES_SETTINGSSizes ()
 
void SetFailureReason (const wxString &aReason)
 
const wxString & FailureReason () const
 
PLACEMENT_ALGOPlacer ()
 
ROUTER_IFACEGetInterface () const
 
void SetVisibleViewArea (const BOX2I &aExtents)
 
const BOX2IVisibleViewArea () const
 

Static Public Member Functions

static ROUTERGetInstance ()
 

Private Member Functions

void movePlacing (const VECTOR2I &aP, ITEM *aItem)
 
void moveDragging (const VECTOR2I &aP, ITEM *aItem)
 
void updateView (NODE *aNode, ITEM_SET &aCurrent, bool aDragging=false)
 
void markViolations (NODE *aNode, ITEM_SET &aCurrent, NODE::ITEM_VECTOR &aRemoved)
 
bool isStartingPointRoutable (const VECTOR2I &aWhere, ITEM *aItem, int aLayer)
 

Private Attributes

BOX2I m_visibleViewArea
 
VECTOR2I m_currentEnd
 
RouterState m_state
 
std::unique_ptr< NODEm_world
 
NODEm_lastNode
 
std::unique_ptr< PLACEMENT_ALGOm_placer
 
std::unique_ptr< DRAG_ALGOm_dragger
 
std::unique_ptr< SHOVEm_shove
 
ROUTER_IFACEm_iface
 
int m_iterLimit
 
bool m_forceMarkObstaclesMode = false
 
ROUTING_SETTINGSm_settings
 
SIZES_SETTINGS m_sizes
 
ROUTER_MODE m_mode
 
LOGGERm_logger
 
wxString m_toolStatusbarName
 
wxString m_failureReason
 

Detailed Description

Definition at line 120 of file pns_router.h.

Member Enumeration Documentation

◆ RouterState

Enumerator
IDLE 
DRAG_SEGMENT 
ROUTE_TRACK 

Definition at line 123 of file pns_router.h.

Constructor & Destructor Documentation

◆ ROUTER()

PNS::ROUTER::ROUTER ( )

Definition at line 61 of file pns_router.cpp.

62 {
63  theRouter = this;
64 
65  m_state = IDLE;
67 
68  m_logger = new LOGGER;
69 
70  // Initialize all other variables:
71  m_lastNode = nullptr;
72  m_iterLimit = 0;
73  m_settings = nullptr;
74  m_iface = nullptr;
76 }
BOX2I m_visibleViewArea
Definition: pns_router.h:241
int m_iterLimit
Definition: pns_router.h:254
ROUTING_SETTINGS * m_settings
Definition: pns_router.h:257
NODE * m_lastNode
Definition: pns_router.h:246
void SetMaximum()
Definition: box2.h:73
RouterState m_state
Definition: pns_router.h:243
ROUTER_IFACE * m_iface
Definition: pns_router.h:252
LOGGER * m_logger
Definition: pns_router.h:260
static ROUTER * theRouter
Definition: pns_router.cpp:59
ROUTER_MODE m_mode
Definition: pns_router.h:259

References IDLE, m_iface, m_iterLimit, m_lastNode, m_logger, m_mode, m_settings, m_state, m_visibleViewArea, PNS::PNS_MODE_ROUTE_SINGLE, BOX2< Vec >::SetMaximum(), and PNS::theRouter.

◆ ~ROUTER()

PNS::ROUTER::~ROUTER ( )

Definition at line 85 of file pns_router.cpp.

86 {
87  ClearWorld();
88  theRouter = nullptr;
89  delete m_logger;
90 }
void ClearWorld()
Definition: pns_router.cpp:102
LOGGER * m_logger
Definition: pns_router.h:260
static ROUTER * theRouter
Definition: pns_router.cpp:59

References ClearWorld(), m_logger, and PNS::theRouter.

Member Function Documentation

◆ BreakSegment()

void PNS::ROUTER::BreakSegment ( ITEM aItem,
const VECTOR2I aP 
)

Definition at line 801 of file pns_router.cpp.

802 {
803  NODE *node = m_world->Branch();
804 
805  LINE_PLACER placer( this );
806 
807  if( placer.SplitAdjacentSegments( node, aItem, aP ) )
808  {
809  CommitRouting( node );
810  }
811  else
812  {
813  delete node;
814  }
815 }
void CommitRouting()
Definition: pns_router.cpp:655
std::unique_ptr< NODE > m_world
Definition: pns_router.h:245

References CommitRouting(), m_world, and PNS::LINE_PLACER::SplitAdjacentSegments().

Referenced by ROUTER_TOOL::breakTrack().

◆ ClearViewDecorations()

void PNS::ROUTER::ClearViewDecorations ( )

◆ ClearWorld()

void PNS::ROUTER::ClearWorld ( )

Definition at line 102 of file pns_router.cpp.

103 {
104  if( m_world )
105  {
106  m_world->KillChildren();
107  m_world.reset();
108  }
109 
110  m_placer.reset();
111 }
std::unique_ptr< PLACEMENT_ALGO > m_placer
Definition: pns_router.h:248
std::unique_ptr< NODE > m_world
Definition: pns_router.h:245

References m_placer, and m_world.

Referenced by ROUTER_TOOL::MainLoop(), PNS::TOOL_BASE::Reset(), SyncWorld(), and ~ROUTER().

◆ CommitRouting() [1/2]

◆ CommitRouting() [2/2]

void PNS::ROUTER::CommitRouting ( NODE aNode)

Definition at line 574 of file pns_router.cpp.

575 {
576  if( m_state == ROUTE_TRACK && !m_placer->HasPlacedAnything() )
577  return;
578 
579  NODE::ITEM_VECTOR removed;
580  NODE::ITEM_VECTOR added;
581  NODE::ITEM_VECTOR changed;
582 
583  aNode->GetUpdatedItems( removed, added );
584 
585  for( ITEM* item : removed )
586  {
587  bool is_changed = false;
588 
589  // Items in remove/add that share the same parent are just updated versions
590  // We move them to the updated vector to preserve attributes such as UUID and pad data
591  if( item->Parent() )
592  {
593  for( NODE::ITEM_VECTOR::iterator added_it = added.begin();
594  added_it != added.end(); ++added_it )
595  {
596  if( ( *added_it )->Parent() && ( *added_it )->Parent() == item->Parent() )
597  {
598  changed.push_back( *added_it );
599  added.erase( added_it );
600  is_changed = true;
601  break;
602  }
603  }
604  }
605 
606  if( !is_changed )
607  m_iface->RemoveItem( item );
608  }
609 
610  for( ITEM* item : added )
611  m_iface->AddItem( item );
612 
613  for( ITEM* item : changed )
614  m_iface->UpdateItem( item );
615 
616  m_iface->Commit();
617  m_world->Commit( aNode );
618 }
std::unique_ptr< PLACEMENT_ALGO > m_placer
Definition: pns_router.h:248
virtual void AddItem(ITEM *aItem)=0
std::unique_ptr< NODE > m_world
Definition: pns_router.h:245
RouterState m_state
Definition: pns_router.h:243
ROUTER_IFACE * m_iface
Definition: pns_router.h:252
virtual void UpdateItem(ITEM *aItem)=0
virtual void Commit()=0
virtual void RemoveItem(ITEM *aItem)=0
std::vector< ITEM * > ITEM_VECTOR
Definition: pns_node.h:153

References PNS::ROUTER_IFACE::AddItem(), PNS::ROUTER_IFACE::Commit(), PNS::NODE::GetUpdatedItems(), m_iface, m_placer, m_state, m_world, PNS::ROUTER_IFACE::RemoveItem(), ROUTE_TRACK, and PNS::ROUTER_IFACE::UpdateItem().

◆ FailureReason()

const wxString& PNS::ROUTER::FailureReason ( ) const
inline

Definition at line 211 of file pns_router.h.

211 { return m_failureReason; }
wxString m_failureReason
Definition: pns_router.h:263

References m_failureReason.

Referenced by LENGTH_TUNER_TOOL::performTuning(), and ROUTER_TOOL::prepareInteractive().

◆ FixRoute()

bool PNS::ROUTER::FixRoute ( const VECTOR2I aP,
ITEM aItem,
bool  aForceFinish = false 
)

Definition at line 621 of file pns_router.cpp.

622 {
623  bool rv = false;
624 
625  if( m_logger )
626  m_logger->Log( LOGGER::EVT_FIX, aP, aEndItem );
627 
628  switch( m_state )
629  {
630  case ROUTE_TRACK:
631  rv = m_placer->FixRoute( aP, aEndItem, aForceFinish );
632  break;
633 
634  case DRAG_SEGMENT:
635  rv = m_dragger->FixRoute();
636  break;
637 
638  default:
639  break;
640  }
641 
642  return rv;
643 }
std::unique_ptr< PLACEMENT_ALGO > m_placer
Definition: pns_router.h:248
std::unique_ptr< DRAG_ALGO > m_dragger
Definition: pns_router.h:249
RouterState m_state
Definition: pns_router.h:243
LOGGER * m_logger
Definition: pns_router.h:260
void Log(EVENT_TYPE evt, VECTOR2I pos, const ITEM *item=nullptr)
Definition: pns_logger.cpp:73

References DRAG_SEGMENT, PNS::LOGGER::EVT_FIX, PNS::LOGGER::Log(), m_dragger, m_logger, m_placer, m_state, and ROUTE_TRACK.

Referenced by ROUTER_TOOL::InlineDrag(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), and LENGTH_TUNER_TOOL::performTuning().

◆ FlipPosture()

void PNS::ROUTER::FlipPosture ( )

Definition at line 698 of file pns_router.cpp.

699 {
700  if( m_state == ROUTE_TRACK )
701  {
702  m_placer->FlipPosture();
703  }
704 }
std::unique_ptr< PLACEMENT_ALGO > m_placer
Definition: pns_router.h:248
RouterState m_state
Definition: pns_router.h:243

References m_placer, m_state, and ROUTE_TRACK.

Referenced by ROUTER_TOOL::performRouting().

◆ GetCurrentLayer()

int PNS::ROUTER::GetCurrentLayer ( ) const

Definition at line 737 of file pns_router.cpp.

738 {
739  if( m_placer )
740  return m_placer->CurrentLayer();
741  else if( m_dragger )
742  return m_dragger->CurrentLayer();
743 
744  return -1;
745 }
std::unique_ptr< PLACEMENT_ALGO > m_placer
Definition: pns_router.h:248
std::unique_ptr< DRAG_ALGO > m_dragger
Definition: pns_router.h:249

References m_dragger, and m_placer.

Referenced by ROUTER_TOOL::handleLayerSwitch(), ROUTER_TOOL::performRouting(), ROUTER_TOOL::switchLayerOnViaPlacement(), and PNS::TOOL_BASE::updateEndItem().

◆ GetCurrentNets()

const std::vector< int > PNS::ROUTER::GetCurrentNets ( ) const

Definition at line 726 of file pns_router.cpp.

727 {
728  if( m_placer )
729  return m_placer->CurrentNets();
730  else if( m_dragger )
731  return m_dragger->CurrentNets();
732 
733  return std::vector<int>();
734 }
std::unique_ptr< PLACEMENT_ALGO > m_placer
Definition: pns_router.h:248
std::unique_ptr< DRAG_ALGO > m_dragger
Definition: pns_router.h:249

References m_dragger, and m_placer.

Referenced by ROUTER_TOOL::handleLayerSwitch(), ROUTER_TOOL::onTrackViaSizeChanged(), and PNS::TOOL_BASE::updateEndItem().

◆ GetDragger()

DRAG_ALGO* PNS::ROUTER::GetDragger ( )
inline

Definition at line 140 of file pns_router.h.

140 { return m_dragger.get(); }
std::unique_ptr< DRAG_ALGO > m_dragger
Definition: pns_router.h:249

References m_dragger.

◆ GetInstance()

◆ GetInterface()

◆ GetIterLimit()

int PNS::ROUTER::GetIterLimit ( ) const
inline

Definition at line 187 of file pns_router.h.

187 { return m_iterLimit; };
int m_iterLimit
Definition: pns_router.h:254

References m_iterLimit.

◆ GetRuleResolver()

RULE_RESOLVER* PNS::ROUTER::GetRuleResolver ( ) const
inline

Definition at line 174 of file pns_router.h.

175  {
176  return m_iface->GetRuleResolver();
177  }
virtual RULE_RESOLVER * GetRuleResolver()=0
ROUTER_IFACE * m_iface
Definition: pns_router.h:252

References PNS::ROUTER_IFACE::GetRuleResolver(), and m_iface.

Referenced by movePlacing(), and updateView().

◆ GetState()

RouterState PNS::ROUTER::GetState ( ) const
inline

Definition at line 138 of file pns_router.h.

138 { return m_state; }
RouterState m_state
Definition: pns_router.h:243

References m_state.

◆ GetWorld()

◆ IsPlacingVia()

bool PNS::ROUTER::IsPlacingVia ( ) const

Definition at line 754 of file pns_router.cpp.

755 {
756  if( !m_placer )
757  return false;
758 
759  return m_placer->IsPlacingVia();
760 }
std::unique_ptr< PLACEMENT_ALGO > m_placer
Definition: pns_router.h:248

References m_placer.

Referenced by ROUTER_TOOL::handleLayerSwitch(), ROUTER_TOOL::performRouting(), and PNS::TOOL_BASE::updateEndItem().

◆ isStartingPointRoutable()

bool PNS::ROUTER::isStartingPointRoutable ( const VECTOR2I aWhere,
ITEM aItem,
int  aLayer 
)
private

Definition at line 183 of file pns_router.cpp.

184 {
185  if( Settings().CanViolateDRC() && Settings().Mode() == RM_MarkObstacles )
186  return true;
187 
188  ITEM_SET candidates = QueryHoverItems( aWhere );
189 
190  for( ITEM* item : candidates.Items() )
191  {
192  if( !item->IsRoutable() && item->Layers().Overlaps( aLayer ) )
193  {
194  BOARD_ITEM* parent = item->Parent();
195 
196  switch( parent->Type() )
197  {
198  case PCB_PAD_T:
199  {
200  PAD* pad = static_cast<PAD*>( parent );
201 
202  if( pad->GetAttribute() == PAD_ATTRIB_NPTH )
203  SetFailureReason( _( "Cannot start routing from a non-plated hole." ) );
204  }
205  break;
206 
207  case PCB_ZONE_T:
208  case PCB_FP_ZONE_T:
209  {
210  ZONE* zone = static_cast<ZONE*>( parent );
211 
212  if( !zone->GetZoneName().IsEmpty() )
213  {
214  SetFailureReason( wxString::Format( _( "Rule area '%s' disallows tracks." ),
215  zone->GetZoneName() ) );
216  }
217  else
218  {
219  SetFailureReason( _( "Rule area disallows tracks." ) );
220  }
221  }
222  break;
223 
224  case PCB_TEXT_T:
225  case PCB_FP_TEXT_T:
226  SetFailureReason( _( "Cannot start routing from a text item." ) );
227  break;
228 
229  case PCB_SHAPE_T:
230  case PCB_FP_SHAPE_T:
231  SetFailureReason( _( "Cannot start routing from a graphic." ) );
232 
233  default:
234  break;
235  }
236 
237  return false;
238  }
239  }
240 
241  VECTOR2I startPoint = aStartItem ? aStartItem->Anchor( 0 ) : aWhere;
242 
243  if( aStartItem && aStartItem->OfKind( ITEM::SEGMENT_T | ITEM::ARC_T ) )
244  {
245  VECTOR2I otherEnd = aStartItem->Anchor( 1 );
246 
247  if( ( otherEnd - aWhere ).SquaredEuclideanNorm()
248  < ( startPoint - aWhere ).SquaredEuclideanNorm() )
249  {
250  startPoint = otherEnd;
251  }
252  }
253 
255  {
256  SHAPE_LINE_CHAIN dummyStartSeg;
257  LINE dummyStartLine;
258 
259  dummyStartSeg.Append( startPoint );
260  dummyStartSeg.Append( startPoint, true );
261 
262  dummyStartLine.SetShape( dummyStartSeg );
263  dummyStartLine.SetLayer( aLayer );
264  dummyStartLine.SetNet( aStartItem ? aStartItem->Net() : 0 );
265  dummyStartLine.SetWidth( m_sizes.TrackWidth() );
266 
267  if( m_world->CheckColliding( &dummyStartLine, ITEM::ANY_T ) )
268  {
269  ITEM_SET dummyStartSet( &dummyStartLine );
270  NODE::ITEM_VECTOR highlightedItems;
271 
272  markViolations( m_world.get(), dummyStartSet, highlightedItems );
273 
274  for( ITEM* item : highlightedItems )
275  m_iface->HideItem( item );
276 
277  SetFailureReason( _( "The routing start point violates DRC." ) );
278  return false;
279  }
280  }
281  else if( m_mode == PNS_MODE_ROUTE_DIFF_PAIR )
282  {
283  if( !aStartItem )
284  {
285  SetFailureReason( _( "Cannot start a differential pair in the middle of nowhere." ) );
286  return false;
287  }
288 
289  DP_PRIMITIVE_PAIR dpPair;
290  wxString errorMsg;
291 
292  if( !DIFF_PAIR_PLACER::FindDpPrimitivePair( m_world.get(), startPoint, aStartItem, dpPair,
293  &errorMsg ) )
294  {
295  SetFailureReason( errorMsg );
296  return false;
297  }
298 
299  SHAPE_LINE_CHAIN dummyStartSegA;
300  SHAPE_LINE_CHAIN dummyStartSegB;
301  LINE dummyStartLineA;
302  LINE dummyStartLineB;
303 
304  dummyStartSegA.Append( dpPair.AnchorN() );
305  dummyStartSegA.Append( dpPair.AnchorN(), true );
306 
307  dummyStartSegB.Append( dpPair.AnchorP() );
308  dummyStartSegB.Append( dpPair.AnchorP(), true );
309 
310  dummyStartLineA.SetShape( dummyStartSegA );
311  dummyStartLineA.SetLayer( aLayer );
312  dummyStartLineA.SetNet( dpPair.PrimN()->Net() );
313  dummyStartLineA.SetWidth( m_sizes.DiffPairWidth() );
314 
315  dummyStartLineB.SetShape( dummyStartSegB );
316  dummyStartLineB.SetLayer( aLayer );
317  dummyStartLineB.SetNet( dpPair.PrimP()->Net() );
318  dummyStartLineB.SetWidth( m_sizes.DiffPairWidth() );
319 
320  if( m_world->CheckColliding( &dummyStartLineA, ITEM::ANY_T )
321  || m_world->CheckColliding( &dummyStartLineB, ITEM::ANY_T ) )
322  {
323  ITEM_SET dummyStartSet;
324  NODE::ITEM_VECTOR highlightedItems;
325 
326  dummyStartSet.Add( dummyStartLineA );
327  dummyStartSet.Add( dummyStartLineB );
328  markViolations( m_world.get(), dummyStartSet, highlightedItems );
329 
330  for( ITEM* item : highlightedItems )
331  m_iface->HideItem( item );
332 
333  SetFailureReason( _( "The routing start point violates DRC." ) );
334  return false;
335  }
336  }
337 
338  return true;
339 }
class FP_TEXT, text in a footprint
Definition: typeinfo.h:92
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:82
const ITEM_SET QueryHoverItems(const VECTOR2I &aP)
Definition: pns_router.cpp:120
virtual void HideItem(ITEM *aItem)=0
class PCB_TEXT, text on a layer
Definition: typeinfo.h:91
class FP_SHAPE, a footprint edge
Definition: typeinfo.h:93
class PAD, a pad in a footprint
Definition: typeinfo.h:89
like PAD_PTH, but not plated mechanical use only, no connection allowed
Definition: pad_shapes.h:85
void Append(int aX, int aY, bool aAllowDuplication=false)
Function Append()
std::unique_ptr< NODE > m_world
Definition: pns_router.h:245
PAD_ATTR_T GetAttribute() const
Definition: pad.h:363
void SetFailureReason(const wxString &aReason)
Definition: pns_router.h:210
ROUTER_IFACE * m_iface
Definition: pns_router.h:252
ZONE handles a list of polygons defining a copper zone.
Definition: zone.h:57
class ZONE, a copper pour area
Definition: typeinfo.h:105
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
Ignore collisions, mark obstacles.
#define _(s)
Definition: 3d_actions.cpp:33
SHAPE_LINE_CHAIN.
class ZONE, managed by a footprint
Definition: typeinfo.h:94
static bool FindDpPrimitivePair(NODE *aWorld, const VECTOR2I &aP, ITEM *aItem, DP_PRIMITIVE_PAIR &aPair, wxString *aErrorMsg=nullptr)
SIZES_SETTINGS m_sizes
Definition: pns_router.h:258
ROUTER_MODE m_mode
Definition: pns_router.h:259
Definition: pad.h:60
wxString GetZoneName() const
Definition: zone.h:131
ROUTER_MODE Mode() const
Definition: pns_router.h:136
class PCB_SHAPE, a segment not on copper layers
Definition: typeinfo.h:90
ROUTING_SETTINGS & Settings()
Definition: pns_router.h:189
std::vector< ITEM * > ITEM_VECTOR
Definition: pns_node.h:153
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:162
void markViolations(NODE *aNode, ITEM_SET &aCurrent, NODE::ITEM_VECTOR &aRemoved)
Definition: pns_router.cpp:431

References _, PNS::ITEM_SET::Add(), PNS::ITEM::Anchor(), PNS::ITEM::ANY_T, SHAPE_LINE_CHAIN::Append(), PNS::ITEM::ARC_T, PNS::SIZES_SETTINGS::DiffPairWidth(), PNS::DIFF_PAIR_PLACER::FindDpPrimitivePair(), Format(), PAD::GetAttribute(), ZONE::GetZoneName(), PNS::ROUTER_IFACE::HideItem(), PNS::ITEM_SET::Items(), m_iface, m_mode, m_sizes, m_world, markViolations(), Mode(), PNS::ITEM::Net(), PNS::ITEM::OfKind(), PAD_ATTRIB_NPTH, PCB_FP_SHAPE_T, PCB_FP_TEXT_T, PCB_FP_ZONE_T, PCB_PAD_T, PCB_SHAPE_T, PCB_TEXT_T, PCB_ZONE_T, PNS::PNS_MODE_ROUTE_DIFF_PAIR, PNS::PNS_MODE_ROUTE_SINGLE, QueryHoverItems(), PNS::RM_MarkObstacles, PNS::ITEM::SEGMENT_T, SetFailureReason(), PNS::ITEM::SetLayer(), PNS::ITEM::SetNet(), PNS::LINE::SetShape(), Settings(), PNS::LINE::SetWidth(), PNS::SIZES_SETTINGS::TrackWidth(), and EDA_ITEM::Type().

Referenced by StartRouting().

◆ LoadSettings()

void PNS::ROUTER::LoadSettings ( ROUTING_SETTINGS aSettings)
inline

Changes routing settings to ones passed in the parameter.

Parameters
aSettingsare the new settings.

Definition at line 203 of file pns_router.h.

204  {
205  m_settings = aSettings;
206  }
ROUTING_SETTINGS * m_settings
Definition: pns_router.h:257

References m_settings.

Referenced by PNS::TOOL_BASE::Reset().

◆ Logger()

LOGGER * PNS::ROUTER::Logger ( )

Definition at line 748 of file pns_router.cpp.

749 {
750  return m_logger;
751 }
LOGGER * m_logger
Definition: pns_router.h:260

References m_logger.

Referenced by ROUTER_TOOL::saveRouterDebugLog().

◆ markViolations()

void PNS::ROUTER::markViolations ( NODE aNode,
ITEM_SET aCurrent,
NODE::ITEM_VECTOR aRemoved 
)
private

Definition at line 431 of file pns_router.cpp.

432 {
433  auto updateItem =
434  [&]( ITEM* currentItem, ITEM* itemToMark )
435  {
436  std::unique_ptr<ITEM> tmp( itemToMark->Clone() );
437  int clearance;
438  bool removeOriginal = true;
439 
440  if( itemToMark->Marker() & MK_HOLE )
441  clearance = aNode->GetHoleClearance( currentItem, itemToMark );
442  else
443  clearance = aNode->GetClearance( currentItem, itemToMark );
444 
445  if( itemToMark->Layers().IsMultilayer() && !currentItem->Layers().IsMultilayer() )
446  tmp->SetLayer( currentItem->Layer() );
447 
448  if( itemToMark->Kind() == ITEM::SOLID_T )
449  {
450  if( ( itemToMark->Marker() & PNS::MK_HOLE )
451  || !m_iface->IsFlashedOnLayer( itemToMark, itemToMark->Layer() ) )
452  {
453  SOLID* solid = static_cast<SOLID*>( tmp.get() );
454  solid->SetShape( solid->Hole()->Clone() );
455 
456  // Leave the pad flashing around the highlighted hole
457  removeOriginal = false;
458  }
459  }
460 
461  m_iface->DisplayItem( tmp.get(), clearance );
462 
463  if( removeOriginal )
464  aRemoved.push_back( itemToMark );
465  };
466 
467  for( ITEM* item : aCurrent.Items() )
468  {
469  NODE::OBSTACLES obstacles;
470 
471  aNode->QueryColliding( item, obstacles, ITEM::ANY_T );
472 
473  if( item->OfKind( ITEM::LINE_T ) )
474  {
475  LINE* l = static_cast<LINE*>( item );
476 
477  if( l->EndsWithVia() )
478  {
479  VIA v( l->Via() );
480  aNode->QueryColliding( &v, obstacles, ITEM::ANY_T );
481  }
482  }
483 
484  for( OBSTACLE& obs : obstacles )
485  {
486  obs.m_item->Mark( obs.m_item->Marker() | MK_VIOLATION );
487  updateItem( item, obs.m_item );
488  }
489 
490  if( item->Kind() == ITEM::LINE_T )
491  {
492  LINE* line = static_cast<LINE*>( item );
493 
494  // Show clearance on any blocking obstacles
495  if( line->GetBlockingObstacle() )
496  updateItem( item, line->GetBlockingObstacle() );
497  }
498  }
499 }
Definition: track.h:343
virtual void DisplayItem(const ITEM *aItem, int aClearance, bool aEdit=false)=0
ROUTER_IFACE * m_iface
Definition: pns_router.h:252
virtual bool IsFlashedOnLayer(const PNS::ITEM *aItem, int aLayer) const =0
std::vector< OBSTACLE > OBSTACLES
Definition: pns_node.h:154

References PNS::ITEM::ANY_T, SHAPE::Clone(), PNS::ROUTER_IFACE::DisplayItem(), PNS::LINE::EndsWithVia(), PNS::LINE::GetBlockingObstacle(), PNS::NODE::GetClearance(), PNS::NODE::GetHoleClearance(), PNS::SOLID::Hole(), PNS::ROUTER_IFACE::IsFlashedOnLayer(), LAYER_RANGE::IsMultilayer(), PNS::ITEM_SET::Items(), PNS::ITEM::Layer(), PNS::ITEM::Layers(), PNS::ITEM::LINE_T, m_iface, PNS::MK_HOLE, PNS::MK_VIOLATION, PNS::NODE::QueryColliding(), PNS::SOLID::SetShape(), PNS::ITEM::SOLID_T, and PNS::LINE::Via().

Referenced by isStartingPointRoutable(), and updateView().

◆ Mode()

◆ Move()

void PNS::ROUTER::Move ( const VECTOR2I aP,
ITEM aItem 
)

Definition at line 397 of file pns_router.cpp.

398 {
399  m_currentEnd = aP;
400 
401  if( m_logger )
402  m_logger->Log( LOGGER::EVT_MOVE, aP, endItem );
403 
404  switch( m_state )
405  {
406  case ROUTE_TRACK:
407  movePlacing( aP, endItem );
408  break;
409 
410  case DRAG_SEGMENT:
411  moveDragging( aP, endItem );
412  break;
413 
414  default:
415  break;
416  }
417 }
void moveDragging(const VECTOR2I &aP, ITEM *aItem)
Definition: pns_router.cpp:420
VECTOR2I m_currentEnd
Definition: pns_router.h:242
RouterState m_state
Definition: pns_router.h:243
void movePlacing(const VECTOR2I &aP, ITEM *aItem)
Definition: pns_router.cpp:538
LOGGER * m_logger
Definition: pns_router.h:260
void Log(EVENT_TYPE evt, VECTOR2I pos, const ITEM *item=nullptr)
Definition: pns_logger.cpp:73

References DRAG_SEGMENT, PNS::LOGGER::EVT_MOVE, PNS::LOGGER::Log(), m_currentEnd, m_logger, m_state, moveDragging(), movePlacing(), and ROUTE_TRACK.

Referenced by ROUTER_TOOL::handleLayerSwitch(), ROUTER_TOOL::InlineDrag(), ROUTER_TOOL::onTrackViaSizeChanged(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), and LENGTH_TUNER_TOOL::performTuning().

◆ moveDragging()

void PNS::ROUTER::moveDragging ( const VECTOR2I aP,
ITEM aItem 
)
private

Definition at line 420 of file pns_router.cpp.

421 {
422  m_iface->EraseView();
423 
424  m_dragger->Drag( aP );
425  ITEM_SET dragged = m_dragger->Traces();
426 
427  updateView( m_dragger->CurrentNode(), dragged, true );
428 }
std::unique_ptr< DRAG_ALGO > m_dragger
Definition: pns_router.h:249
void updateView(NODE *aNode, ITEM_SET &aCurrent, bool aDragging=false)
Definition: pns_router.cpp:502
ROUTER_IFACE * m_iface
Definition: pns_router.h:252
virtual void EraseView()=0

References PNS::ROUTER_IFACE::EraseView(), m_dragger, m_iface, and updateView().

Referenced by Move().

◆ movePlacing()

void PNS::ROUTER::movePlacing ( const VECTOR2I aP,
ITEM aItem 
)
private

Definition at line 538 of file pns_router.cpp.

539 {
540  m_iface->EraseView();
541 
542  m_placer->Move( aP, aEndItem );
543  ITEM_SET current = m_placer->Traces();
544 
545  for( const ITEM* item : current.CItems() )
546  {
547  if( !item->OfKind( ITEM::LINE_T ) )
548  continue;
549 
550  const LINE* l = static_cast<const LINE*>( item );
551  int clearance = GetRuleResolver()->Clearance( item, nullptr );
552 
553  m_iface->DisplayItem( l, clearance );
554 
555  if( l->EndsWithVia() )
556  {
557  const VIA& via = l->Via();
558  int viaClearance = GetRuleResolver()->Clearance( &via, nullptr );
559  int holeClearance = GetRuleResolver()->HoleClearance( &via, nullptr );
560 
561  if( holeClearance + via.Drill() / 2 > viaClearance + via.Diameter() / 2 )
562  viaClearance = holeClearance + via.Drill() / 2 - via.Diameter() / 2;
563 
564  m_iface->DisplayItem( &l->Via(), viaClearance );
565  }
566  }
567 
568  //ITEM_SET tmp( &current );
569 
570  updateView( m_placer->CurrentNode( true ), current );
571 }
Definition: track.h:343
RULE_RESOLVER * GetRuleResolver() const
Definition: pns_router.h:174
std::unique_ptr< PLACEMENT_ALGO > m_placer
Definition: pns_router.h:248
virtual int Clearance(const ITEM *aA, const ITEM *aB)=0
virtual void DisplayItem(const ITEM *aItem, int aClearance, bool aEdit=false)=0
void updateView(NODE *aNode, ITEM_SET &aCurrent, bool aDragging=false)
Definition: pns_router.cpp:502
virtual int HoleClearance(const ITEM *aA, const ITEM *aB)=0
ROUTER_IFACE * m_iface
Definition: pns_router.h:252
virtual void EraseView()=0

References PNS::ITEM_SET::CItems(), PNS::RULE_RESOLVER::Clearance(), PNS::VIA::Diameter(), PNS::ROUTER_IFACE::DisplayItem(), PNS::VIA::Drill(), PNS::LINE::EndsWithVia(), PNS::ROUTER_IFACE::EraseView(), GetRuleResolver(), PNS::RULE_RESOLVER::HoleClearance(), PNS::ITEM::LINE_T, m_iface, m_placer, updateView(), and PNS::LINE::Via().

Referenced by Move().

◆ Placer()

PLACEMENT_ALGO* PNS::ROUTER::Placer ( )
inline

Definition at line 213 of file pns_router.h.

213 { return m_placer.get(); }
std::unique_ptr< PLACEMENT_ALGO > m_placer
Definition: pns_router.h:248

References m_placer.

Referenced by LENGTH_TUNER_TOOL::meanderSettingsDialog(), LENGTH_TUNER_TOOL::performTuning(), and PNS_TUNE_STATUS_POPUP::UpdateStatus().

◆ QueryHoverItems()

const ITEM_SET PNS::ROUTER::QueryHoverItems ( const VECTOR2I aP)

Definition at line 120 of file pns_router.cpp.

121 {
122  if( m_state == IDLE || m_placer == nullptr )
123  return m_world->HitTest( aP );
124  else
125  return m_placer->CurrentNode()->HitTest( aP );
126 }
std::unique_ptr< PLACEMENT_ALGO > m_placer
Definition: pns_router.h:248
std::unique_ptr< NODE > m_world
Definition: pns_router.h:245
RouterState m_state
Definition: pns_router.h:243

References IDLE, m_placer, m_state, and m_world.

Referenced by isStartingPointRoutable(), and PNS::TOOL_BASE::pickSingleItem().

◆ RoutingInProgress()

bool PNS::ROUTER::RoutingInProgress ( ) const

◆ SetFailureReason()

void PNS::ROUTER::SetFailureReason ( const wxString &  aReason)
inline

◆ SetInterface()

void PNS::ROUTER::SetInterface ( ROUTER_IFACE aIface)

Definition at line 796 of file pns_router.cpp.

797 {
798  m_iface = aIface;
799 }
ROUTER_IFACE * m_iface
Definition: pns_router.h:252

References m_iface.

Referenced by PNS::TOOL_BASE::Reset().

◆ SetIterLimit()

void PNS::ROUTER::SetIterLimit ( int  aX)
inline

Definition at line 186 of file pns_router.h.

186 { m_iterLimit = aX; }
int m_iterLimit
Definition: pns_router.h:254

References m_iterLimit.

◆ SetMode()

void PNS::ROUTER::SetMode ( ROUTER_MODE  aMode)

Definition at line 790 of file pns_router.cpp.

791 {
792  m_mode = aMode;
793 }
ROUTER_MODE m_mode
Definition: pns_router.h:259

References m_mode.

Referenced by ROUTER_TOOL::MainLoop(), and LENGTH_TUNER_TOOL::MainLoop().

◆ SetOrthoMode()

void PNS::ROUTER::SetOrthoMode ( bool  aEnable)

Definition at line 781 of file pns_router.cpp.

782 {
783  if( !m_placer )
784  return;
785 
786  m_placer->SetOrthoMode( aEnable );
787 }
std::unique_ptr< PLACEMENT_ALGO > m_placer
Definition: pns_router.h:248

References m_placer.

Referenced by ROUTER_TOOL::performRouting().

◆ Settings()

◆ SetVisibleViewArea()

void PNS::ROUTER::SetVisibleViewArea ( const BOX2I aExtents)
inline

Definition at line 220 of file pns_router.h.

221  {
222  m_visibleViewArea = aExtents;
223  }
BOX2I m_visibleViewArea
Definition: pns_router.h:241

References m_visibleViewArea.

Referenced by ROUTER_TOOL::handleCommonEvents().

◆ Sizes()

◆ StartDragging() [1/2]

bool PNS::ROUTER::StartDragging ( const VECTOR2I aP,
ITEM aItem,
int  aDragMode = DM_ANY 
)

Definition at line 129 of file pns_router.cpp.

130 {
131  return StartDragging( aP, ITEM_SET( aItem ), aDragMode );
132 }
bool StartDragging(const VECTOR2I &aP, ITEM *aItem, int aDragMode=DM_ANY)
Definition: pns_router.cpp:129

Referenced by ROUTER_TOOL::InlineDrag(), and ROUTER_TOOL::performDragging().

◆ StartDragging() [2/2]

bool PNS::ROUTER::StartDragging ( const VECTOR2I aP,
ITEM_SET  aItems,
int  aDragMode = DM_COMPONENT 
)

Definition at line 135 of file pns_router.cpp.

136 {
137  if( aStartItems.Empty() )
138  return false;
139 
140  if( aStartItems.Count( ITEM::SOLID_T ) == aStartItems.Size() )
141  {
142  m_dragger = std::make_unique<COMPONENT_DRAGGER>( this );
144  }
145  else
146  {
147  if( aDragMode & DM_FREE_ANGLE )
149  else
150  m_forceMarkObstaclesMode = false;
151 
152  m_dragger = std::make_unique<DRAGGER>( this );
153  }
154 
155  m_dragger->SetMode( aDragMode );
156  m_dragger->SetWorld( m_world.get() );
157  m_dragger->SetLogger( m_logger );
158  m_dragger->SetDebugDecorator( m_iface->GetDebugDecorator() );
159 
160  if( m_logger )
161  m_logger->Clear();
162 
163  if( m_logger && aStartItems.Size() )
164  {
165  m_logger->Log( LOGGER::EVT_START_DRAG, aP, aStartItems[0] );
166  }
167 
168  if( m_dragger->Start( aP, aStartItems ) )
169  {
171  }
172  else
173  {
174  m_dragger.reset();
175  m_state = IDLE;
176  return false;
177  }
178 
179  return true;
180 }
std::unique_ptr< NODE > m_world
Definition: pns_router.h:245
std::unique_ptr< DRAG_ALGO > m_dragger
Definition: pns_router.h:249
RouterState m_state
Definition: pns_router.h:243
ROUTER_IFACE * m_iface
Definition: pns_router.h:252
void Clear()
Definition: pns_logger.cpp:47
LOGGER * m_logger
Definition: pns_router.h:260
virtual DEBUG_DECORATOR * GetDebugDecorator()=0
void Log(EVENT_TYPE evt, VECTOR2I pos, const ITEM *item=nullptr)
Definition: pns_logger.cpp:73
bool m_forceMarkObstaclesMode
Definition: pns_router.h:255

References PNS::LOGGER::Clear(), PNS::ITEM_SET::Count(), PNS::DM_FREE_ANGLE, DRAG_SEGMENT, PNS::ITEM_SET::Empty(), PNS::LOGGER::EVT_START_DRAG, PNS::ROUTER_IFACE::GetDebugDecorator(), IDLE, PNS::LOGGER::Log(), m_dragger, m_forceMarkObstaclesMode, m_iface, m_logger, m_state, m_world, PNS::ITEM_SET::Size(), and PNS::ITEM::SOLID_T.

◆ StartRouting()

bool PNS::ROUTER::StartRouting ( const VECTOR2I aP,
ITEM aItem,
int  aLayer 
)

Definition at line 342 of file pns_router.cpp.

343 {
344  if( !isStartingPointRoutable( aP, aStartItem, aLayer ) )
345  return false;
346 
347  m_forceMarkObstaclesMode = false;
348 
349  switch( m_mode )
350  {
352  m_placer = std::make_unique<LINE_PLACER>( this );
353  break;
354 
356  m_placer = std::make_unique<DIFF_PAIR_PLACER>( this );
357  break;
358 
360  m_placer = std::make_unique<MEANDER_PLACER>( this );
361  break;
362 
364  m_placer = std::make_unique<DP_MEANDER_PLACER>( this );
365  break;
366 
368  m_placer = std::make_unique<MEANDER_SKEW_PLACER>( this );
369  break;
370 
371  default:
372  return false;
373  }
374 
375  m_placer->UpdateSizes( m_sizes );
376  m_placer->SetLayer( aLayer );
377  m_placer->SetDebugDecorator( m_iface->GetDebugDecorator() );
378  m_placer->SetLogger( m_logger );
379 
380  if( m_logger )
381  {
382  m_logger->Clear();
383  m_logger->Log( LOGGER::EVT_START_ROUTE, aP, aStartItem );
384  }
385 
386  bool rv = m_placer->Start( aP, aStartItem );
387 
388  if( !rv )
389  return false;
390 
391  m_currentEnd = aP;
393  return rv;
394 }
bool isStartingPointRoutable(const VECTOR2I &aWhere, ITEM *aItem, int aLayer)
Definition: pns_router.cpp:183
std::unique_ptr< PLACEMENT_ALGO > m_placer
Definition: pns_router.h:248
VECTOR2I m_currentEnd
Definition: pns_router.h:242
RouterState m_state
Definition: pns_router.h:243
ROUTER_IFACE * m_iface
Definition: pns_router.h:252
void Clear()
Definition: pns_logger.cpp:47
LOGGER * m_logger
Definition: pns_router.h:260
virtual DEBUG_DECORATOR * GetDebugDecorator()=0
SIZES_SETTINGS m_sizes
Definition: pns_router.h:258
ROUTER_MODE m_mode
Definition: pns_router.h:259
void Log(EVENT_TYPE evt, VECTOR2I pos, const ITEM *item=nullptr)
Definition: pns_logger.cpp:73
bool m_forceMarkObstaclesMode
Definition: pns_router.h:255

References PNS::LOGGER::Clear(), PNS::LOGGER::EVT_START_ROUTE, PNS::ROUTER_IFACE::GetDebugDecorator(), isStartingPointRoutable(), PNS::LOGGER::Log(), m_currentEnd, m_forceMarkObstaclesMode, m_iface, m_logger, m_mode, m_placer, m_sizes, m_state, PNS::PNS_MODE_ROUTE_DIFF_PAIR, PNS::PNS_MODE_ROUTE_SINGLE, PNS::PNS_MODE_TUNE_DIFF_PAIR, PNS::PNS_MODE_TUNE_DIFF_PAIR_SKEW, PNS::PNS_MODE_TUNE_SINGLE, and ROUTE_TRACK.

Referenced by LENGTH_TUNER_TOOL::performTuning(), and ROUTER_TOOL::prepareInteractive().

◆ StopRouting()

void PNS::ROUTER::StopRouting ( )

Definition at line 664 of file pns_router.cpp.

665 {
666  // Update the ratsnest with new changes
667 
668  if( m_placer )
669  {
670  std::vector<int> nets;
671  m_placer->GetModifiedNets( nets );
672 
673  // Update the ratsnest with new changes
674  for( int n : nets )
675  m_iface->UpdateNet( n );
676  }
677 
678  if( !RoutingInProgress() )
679  return;
680 
681  m_placer.reset();
682  m_dragger.reset();
683 
684  m_iface->EraseView();
685 
686  m_state = IDLE;
687  m_world->KillChildren();
688  m_world->ClearRanks();
689 }
std::unique_ptr< PLACEMENT_ALGO > m_placer
Definition: pns_router.h:248
std::unique_ptr< NODE > m_world
Definition: pns_router.h:245
std::unique_ptr< DRAG_ALGO > m_dragger
Definition: pns_router.h:249
virtual void UpdateNet(int aNetCode)=0
RouterState m_state
Definition: pns_router.h:243
ROUTER_IFACE * m_iface
Definition: pns_router.h:252
virtual void EraseView()=0
bool RoutingInProgress() const
Definition: pns_router.cpp:114

References PNS::ROUTER_IFACE::EraseView(), IDLE, m_dragger, m_iface, m_placer, m_state, m_world, RoutingInProgress(), and PNS::ROUTER_IFACE::UpdateNet().

Referenced by CommitRouting(), ROUTER_TOOL::finishInteractive(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), ROUTER_TOOL::MainLoop(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), and LENGTH_TUNER_TOOL::performTuning().

◆ SwitchLayer()

bool PNS::ROUTER::SwitchLayer ( int  layer)

Definition at line 707 of file pns_router.cpp.

708 {
709  if( m_state == ROUTE_TRACK )
710  return m_placer->SetLayer( aLayer );
711 
712  return false;
713 }
std::unique_ptr< PLACEMENT_ALGO > m_placer
Definition: pns_router.h:248
RouterState m_state
Definition: pns_router.h:243

References m_placer, m_state, and ROUTE_TRACK.

Referenced by ROUTER_TOOL::handleLayerSwitch(), ROUTER_TOOL::MainLoop(), and ROUTER_TOOL::switchLayerOnViaPlacement().

◆ SyncWorld()

void PNS::ROUTER::SyncWorld ( )

Definition at line 93 of file pns_router.cpp.

94 {
95  ClearWorld();
96 
97  m_world = std::make_unique<NODE>( );
98  m_iface->SyncWorld( m_world.get() );
99 
100 }
std::unique_ptr< NODE > m_world
Definition: pns_router.h:245
void ClearWorld()
Definition: pns_router.cpp:102
virtual void SyncWorld(NODE *aNode)=0
ROUTER_IFACE * m_iface
Definition: pns_router.h:252

References ClearWorld(), m_iface, m_world, and PNS::ROUTER_IFACE::SyncWorld().

Referenced by ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), ROUTER_TOOL::MainLoop(), and PNS::TOOL_BASE::Reset().

◆ ToggleRounded()

void PNS::ROUTER::ToggleRounded ( )

Definition at line 763 of file pns_router.cpp.

764 {
766 
767  switch( m_settings->GetCornerMode() )
768  {
770  newMode = CORNER_MODE::ROUNDED_45;
771  break;
772 
773  default:
774  break;
775  }
776 
777  m_settings->SetCornerMode( newMode );
778 }
void SetCornerMode(CORNER_MODE aMode)
H/V/45 with filleted corners.
ROUTING_SETTINGS * m_settings
Definition: pns_router.h:257
CORNER_MODE GetCornerMode() const
H/V/45 with mitered corners (default)

References PNS::ROUTING_SETTINGS::GetCornerMode(), m_settings, PNS::MITERED_45, PNS::ROUNDED_45, and PNS::ROUTING_SETTINGS::SetCornerMode().

Referenced by ROUTER_TOOL::performRouting().

◆ ToggleViaPlacement()

void PNS::ROUTER::ToggleViaPlacement ( )

Definition at line 716 of file pns_router.cpp.

717 {
718  if( m_state == ROUTE_TRACK )
719  {
720  bool toggle = !m_placer->IsPlacingVia();
721  m_placer->ToggleVia( toggle );
722  }
723 }
std::unique_ptr< PLACEMENT_ALGO > m_placer
Definition: pns_router.h:248
RouterState m_state
Definition: pns_router.h:243

References m_placer, m_state, and ROUTE_TRACK.

Referenced by ROUTER_TOOL::handleLayerSwitch().

◆ UndoLastSegment()

void PNS::ROUTER::UndoLastSegment ( )

Definition at line 646 of file pns_router.cpp.

647 {
648  if( !RoutingInProgress() )
649  return;
650 
651  m_placer->UnfixRoute();
652 }
std::unique_ptr< PLACEMENT_ALGO > m_placer
Definition: pns_router.h:248
bool RoutingInProgress() const
Definition: pns_router.cpp:114

References m_placer, and RoutingInProgress().

Referenced by ROUTER_TOOL::performRouting().

◆ UpdateSizes()

void PNS::ROUTER::UpdateSizes ( const SIZES_SETTINGS aSizes)

Applies stored settings.

See also
Settings()

Definition at line 526 of file pns_router.cpp.

527 {
528  m_sizes = aSizes;
529 
530  // Change track/via size settings
531  if( m_state == ROUTE_TRACK )
532  {
533  m_placer->UpdateSizes( m_sizes );
534  }
535 }
std::unique_ptr< PLACEMENT_ALGO > m_placer
Definition: pns_router.h:248
RouterState m_state
Definition: pns_router.h:243
SIZES_SETTINGS m_sizes
Definition: pns_router.h:258

References m_placer, m_sizes, m_state, and ROUTE_TRACK.

Referenced by ROUTER_TOOL::DpDimensionsDialog(), ROUTER_TOOL::handleLayerSwitch(), ROUTER_TOOL::onTrackViaSizeChanged(), ROUTER_TOOL::prepareInteractive(), and PNS::TOOL_BASE::Reset().

◆ updateView()

void PNS::ROUTER::updateView ( NODE aNode,
ITEM_SET aCurrent,
bool  aDragging = false 
)
private

Definition at line 502 of file pns_router.cpp.

503 {
504  NODE::ITEM_VECTOR removed, added;
505  NODE::OBSTACLES obstacles;
506 
507  if( !aNode )
508  return;
509 
511  markViolations( aNode, aCurrent, removed );
512 
513  aNode->GetUpdatedItems( removed, added );
514 
515  for( ITEM* item : added )
516  {
517  int clearance = GetRuleResolver()->Clearance( item, nullptr );
518  m_iface->DisplayItem( item, clearance, aDragging );
519  }
520 
521  for( ITEM* item : removed )
522  m_iface->HideItem( item );
523 }
RULE_RESOLVER * GetRuleResolver() const
Definition: pns_router.h:174
virtual void HideItem(ITEM *aItem)=0
virtual int Clearance(const ITEM *aA, const ITEM *aB)=0
virtual void DisplayItem(const ITEM *aItem, int aClearance, bool aEdit=false)=0
ROUTER_IFACE * m_iface
Definition: pns_router.h:252
Ignore collisions, mark obstacles.
std::vector< OBSTACLE > OBSTACLES
Definition: pns_node.h:154
ROUTER_MODE Mode() const
Definition: pns_router.h:136
ROUTING_SETTINGS & Settings()
Definition: pns_router.h:189
bool m_forceMarkObstaclesMode
Definition: pns_router.h:255
std::vector< ITEM * > ITEM_VECTOR
Definition: pns_node.h:153
void markViolations(NODE *aNode, ITEM_SET &aCurrent, NODE::ITEM_VECTOR &aRemoved)
Definition: pns_router.cpp:431

References PNS::RULE_RESOLVER::Clearance(), PNS::ROUTER_IFACE::DisplayItem(), GetRuleResolver(), PNS::NODE::GetUpdatedItems(), PNS::ROUTER_IFACE::HideItem(), m_forceMarkObstaclesMode, m_iface, markViolations(), Mode(), PNS::RM_MarkObstacles, and Settings().

Referenced by moveDragging(), and movePlacing().

◆ VisibleViewArea()

const BOX2I& PNS::ROUTER::VisibleViewArea ( ) const
inline

Definition at line 225 of file pns_router.h.

226  {
227  return m_visibleViewArea;
228  }
BOX2I m_visibleViewArea
Definition: pns_router.h:241

References m_visibleViewArea.

Referenced by PNS::ALGO_BASE::VisibleViewArea().

Member Data Documentation

◆ m_currentEnd

VECTOR2I PNS::ROUTER::m_currentEnd
private

Definition at line 242 of file pns_router.h.

Referenced by Move(), and StartRouting().

◆ m_dragger

std::unique_ptr<DRAG_ALGO> PNS::ROUTER::m_dragger
private

◆ m_failureReason

wxString PNS::ROUTER::m_failureReason
private

Definition at line 263 of file pns_router.h.

Referenced by FailureReason(), and SetFailureReason().

◆ m_forceMarkObstaclesMode

bool PNS::ROUTER::m_forceMarkObstaclesMode = false
private

Definition at line 255 of file pns_router.h.

Referenced by StartDragging(), StartRouting(), and updateView().

◆ m_iface

◆ m_iterLimit

int PNS::ROUTER::m_iterLimit
private

Definition at line 254 of file pns_router.h.

Referenced by GetIterLimit(), ROUTER(), and SetIterLimit().

◆ m_lastNode

NODE* PNS::ROUTER::m_lastNode
private

Definition at line 246 of file pns_router.h.

Referenced by ROUTER().

◆ m_logger

LOGGER* PNS::ROUTER::m_logger
private

Definition at line 260 of file pns_router.h.

Referenced by FixRoute(), Logger(), Move(), ROUTER(), StartDragging(), StartRouting(), and ~ROUTER().

◆ m_mode

ROUTER_MODE PNS::ROUTER::m_mode
private

Definition at line 259 of file pns_router.h.

Referenced by isStartingPointRoutable(), Mode(), ROUTER(), SetMode(), and StartRouting().

◆ m_placer

◆ m_settings

ROUTING_SETTINGS* PNS::ROUTER::m_settings
private

Definition at line 257 of file pns_router.h.

Referenced by LoadSettings(), ROUTER(), Settings(), and ToggleRounded().

◆ m_shove

std::unique_ptr<SHOVE> PNS::ROUTER::m_shove
private

Definition at line 250 of file pns_router.h.

◆ m_sizes

SIZES_SETTINGS PNS::ROUTER::m_sizes
private

Definition at line 258 of file pns_router.h.

Referenced by isStartingPointRoutable(), Sizes(), StartRouting(), and UpdateSizes().

◆ m_state

◆ m_toolStatusbarName

wxString PNS::ROUTER::m_toolStatusbarName
private

Definition at line 262 of file pns_router.h.

◆ m_visibleViewArea

BOX2I PNS::ROUTER::m_visibleViewArea
private

Definition at line 241 of file pns_router.h.

Referenced by ROUTER(), SetVisibleViewArea(), and VisibleViewArea().

◆ m_world

std::unique_ptr<NODE> PNS::ROUTER::m_world
private

The documentation for this class was generated from the following files: