diff --git a/pcbnew/router/pns_utils.cpp b/pcbnew/router/pns_utils.cpp index 566dcefaf0..378b650b59 100644 --- a/pcbnew/router/pns_utils.cpp +++ b/pcbnew/router/pns_utils.cpp @@ -24,6 +24,7 @@ #include "pns_via.h" #include "pns_router.h" #include "pns_debug_decorator.h" +#include "pns_node.h" #include <geometry/shape_arc.h> #include <geometry/shape_segment.h> @@ -531,4 +532,21 @@ const SHAPE_LINE_CHAIN BuildHullForPrimitiveShape( const SHAPE* aShape, int aCle } +void NodeStats( DEBUG_DECORATOR* dbg, wxString label, PNS::NODE *node ) +{ + NODE::ITEM_VECTOR added, removed; + node->GetUpdatedItems( removed, added ); + + PNS_DBG( dbg, BeginGroup, wxString::Format( "node:%s this=%p depth=%d added=%d removed=%d", + label, node, node->Depth(), (int)added.size(), (int) removed.size() ), 0 ); + + for( auto& item : added ) + PNS_DBG( dbg, AddItem, item, BLUE, 10000, wxT("added-item") ); + for( auto& item : removed ) + PNS_DBG( dbg, AddItem, item, RED, 10000, wxString::Format("removed-item") ); + + PNS_DBGN( dbg, EndGroup ); +} + + } diff --git a/pcbnew/router/pns_utils.h b/pcbnew/router/pns_utils.h index 6984cd7486..4186a43655 100644 --- a/pcbnew/router/pns_utils.h +++ b/pcbnew/router/pns_utils.h @@ -35,7 +35,8 @@ constexpr int HULL_MARGIN = 10; class ITEM; class LINE; - +class DEBUG_DECORATOR; +class NODE; /** Various utility functions */ const SHAPE_LINE_CHAIN ArcHull( const SHAPE_ARC& aSeg, int aClearance, int aWalkaroundThickness ); @@ -67,6 +68,9 @@ void HullIntersection( const SHAPE_LINE_CHAIN& hull, const SHAPE_LINE_CHAIN& lin const SHAPE_LINE_CHAIN BuildHullForPrimitiveShape( const SHAPE* aShape, int aClearance, int aWalkaroundThickness ); +void NodeStats( DEBUG_DECORATOR* aDbg, wxString aLabel, NODE *aNode ); + } + #endif // __PNS_UTILS_H