From 26835f582c03e69b0b6c0030e9777c29b52ea1d3 Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Wed, 7 Apr 2021 21:30:18 -0400 Subject: [PATCH] Some situations require more than one dummy Fixes https://gitlab.com/kicad/code/kicad/-/issues/7820 --- pcbnew/router/pns_dragger.cpp | 2 +- pcbnew/router/pns_kicad_iface.cpp | 30 +++++++++++++++--------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/pcbnew/router/pns_dragger.cpp b/pcbnew/router/pns_dragger.cpp index e1c9b195e3..9da6f27dbb 100644 --- a/pcbnew/router/pns_dragger.cpp +++ b/pcbnew/router/pns_dragger.cpp @@ -480,7 +480,7 @@ bool DRAGGER::dragWalkaround( const VECTOR2I& aP ) LINE dragged( m_draggedLine ); LINE draggedWalk( m_draggedLine ); LINE origLine( m_draggedLine ); - + dragged.SetSnapThreshhold( thresh ); if( m_mode == DM_SEGMENT ) diff --git a/pcbnew/router/pns_kicad_iface.cpp b/pcbnew/router/pns_kicad_iface.cpp index 768a8105f3..6fb285cac5 100644 --- a/pcbnew/router/pns_kicad_iface.cpp +++ b/pcbnew/router/pns_kicad_iface.cpp @@ -88,9 +88,9 @@ private: private: PNS::ROUTER_IFACE* m_routerIface; BOARD* m_board; - TRACK m_dummyTrack; - ARC m_dummyArc; - VIA m_dummyVia; + TRACK m_dummyTracks[2]; + ARC m_dummyArcs[2]; + VIA m_dummyVias[2]; int m_clearanceEpsilon; std::map, int> m_clearanceCache; @@ -103,9 +103,9 @@ PNS_PCBNEW_RULE_RESOLVER::PNS_PCBNEW_RULE_RESOLVER( BOARD* aBoard, PNS::ROUTER_IFACE* aRouterIface ) : m_routerIface( aRouterIface ), m_board( aBoard ), - m_dummyTrack( aBoard ), - m_dummyArc( aBoard ), - m_dummyVia( aBoard ) + m_dummyTracks{ { aBoard }, { aBoard } }, + m_dummyArcs{ { aBoard }, { aBoard } }, + m_dummyVias{ { aBoard }, { aBoard } } { if( aBoard ) m_clearanceEpsilon = aBoard->GetDesignSettings().GetDRCEpsilon(); @@ -217,10 +217,10 @@ bool PNS_PCBNEW_RULE_RESOLVER::QueryConstraint( PNS::CONSTRAINT_TYPE aType, { switch( aItemA->Kind() ) { - case PNS::ITEM::ARC_T: parentA = &m_dummyArc; break; - case PNS::ITEM::VIA_T: parentA = &m_dummyVia; break; - case PNS::ITEM::SEGMENT_T: parentA = &m_dummyTrack; break; - case PNS::ITEM::LINE_T: parentA = &m_dummyTrack; break; + case PNS::ITEM::ARC_T: parentA = &m_dummyArcs[0]; break; + case PNS::ITEM::VIA_T: parentA = &m_dummyVias[0]; break; + case PNS::ITEM::SEGMENT_T: parentA = &m_dummyTracks[0]; break; + case PNS::ITEM::LINE_T: parentA = &m_dummyTracks[0]; break; default: break; } @@ -235,10 +235,10 @@ bool PNS_PCBNEW_RULE_RESOLVER::QueryConstraint( PNS::CONSTRAINT_TYPE aType, { switch( aItemB->Kind() ) { - case PNS::ITEM::ARC_T: parentB = &m_dummyArc; break; - case PNS::ITEM::VIA_T: parentB = &m_dummyVia; break; - case PNS::ITEM::SEGMENT_T: parentB = &m_dummyTrack; break; - case PNS::ITEM::LINE_T: parentB = &m_dummyTrack; break; + case PNS::ITEM::ARC_T: parentB = &m_dummyArcs[1]; break; + case PNS::ITEM::VIA_T: parentB = &m_dummyVias[1]; break; + case PNS::ITEM::SEGMENT_T: parentB = &m_dummyTracks[1]; break; + case PNS::ITEM::LINE_T: parentB = &m_dummyTracks[1]; break; default: break; } @@ -369,7 +369,7 @@ bool PNS_KICAD_IFACE_BASE::inheritTrackWidth( PNS::ITEM* aItem, int* aInheritedW assert( aItem->Owner() != NULL ); - auto tryGetTrackWidth = + auto tryGetTrackWidth = []( PNS::ITEM* aPnsItem ) -> int { switch( aPnsItem->Kind() )