diff --git a/pcbnew/router/pns_dp_meander_placer.cpp b/pcbnew/router/pns_dp_meander_placer.cpp index efab556645..580bb9e61e 100644 --- a/pcbnew/router/pns_dp_meander_placer.cpp +++ b/pcbnew/router/pns_dp_meander_placer.cpp @@ -224,13 +224,21 @@ bool DP_MEANDER_PLACER::Move( const VECTOR2I& aP, ITEM* aEndItem ) for( const ITEM* item : m_tunedPathP.CItems() ) { if( const LINE* l = dyn_cast( item ) ) + { PNS_DBG( Dbg(), AddShape, &l->CLine(), YELLOW, 10000, wxT( "tuned-path-p" ) ); + + m_router->GetInterface()->DisplayPathLine( l->CLine(), 1 ); + } } for( const ITEM* item : m_tunedPathN.CItems() ) { if( const LINE* l = dyn_cast( item ) ) + { PNS_DBG( Dbg(), AddShape, &l->CLine(), YELLOW, 10000, wxT( "tuned-path-n" ) ); + + m_router->GetInterface()->DisplayPathLine( l->CLine(), 1 ); + } } int curIndexP = 0, curIndexN = 0; diff --git a/pcbnew/router/pns_kicad_iface.cpp b/pcbnew/router/pns_kicad_iface.cpp index 8751b501c8..0522b93f7d 100644 --- a/pcbnew/router/pns_kicad_iface.cpp +++ b/pcbnew/router/pns_kicad_iface.cpp @@ -1654,6 +1654,25 @@ void PNS_KICAD_IFACE::DisplayItem( const PNS::ITEM* aItem, int aClearance, bool } +void PNS_KICAD_IFACE::DisplayPathLine( const SHAPE_LINE_CHAIN& aLine, int aImportance ) +{ + ROUTER_PREVIEW_ITEM* pitem = new ROUTER_PREVIEW_ITEM( aLine, m_view ); + pitem->SetDepth( ROUTER_PREVIEW_ITEM::PathOverlayDepth ); + + COLOR4D color; + + if( aImportance >= 1 ) + color = COLOR4D( 1.0, 1.0, 0.0, 0.6 ); + else if( aImportance == 0 ) + color = COLOR4D( 0.7, 0.7, 0.7, 0.6 ); + + pitem->SetColor( color ); + + m_previewItems->Add( pitem ); + m_view->Update( m_previewItems ); +} + + void PNS_KICAD_IFACE::DisplayRatline( const SHAPE_LINE_CHAIN& aRatline, int aNetCode ) { ROUTER_PREVIEW_ITEM* pitem = new ROUTER_PREVIEW_ITEM( aRatline, m_view ); diff --git a/pcbnew/router/pns_kicad_iface.h b/pcbnew/router/pns_kicad_iface.h index 554de5b7c3..6148cc95c2 100644 --- a/pcbnew/router/pns_kicad_iface.h +++ b/pcbnew/router/pns_kicad_iface.h @@ -60,6 +60,7 @@ public: bool IsItemVisible( const PNS::ITEM* aItem ) const override { return true; }; void HideItem( PNS::ITEM* aItem ) override {} void DisplayItem( const PNS::ITEM* aItem, int aClearance, bool aEdit = false, bool aIsHeadTrace = false ) override {} + void DisplayPathLine( const SHAPE_LINE_CHAIN& aLine, int aImportance ) override {} void DisplayRatline( const SHAPE_LINE_CHAIN& aRatline, int aNetCode ) override {} void AddItem( PNS::ITEM* aItem ) override; void UpdateItem( PNS::ITEM* aItem ) override; @@ -116,6 +117,7 @@ public: bool IsItemVisible( const PNS::ITEM* aItem ) const override; void HideItem( PNS::ITEM* aItem ) override; void DisplayItem( const PNS::ITEM* aItem, int aClearance, bool aEdit = false, bool aIsHeadTrace = false ) override; + void DisplayPathLine( const SHAPE_LINE_CHAIN& aLine, int aImportance ) override; void DisplayRatline( const SHAPE_LINE_CHAIN& aRatline, int aNetCode ) override; void Commit() override; void AddItem( PNS::ITEM* aItem ) override; diff --git a/pcbnew/router/pns_meander_placer.cpp b/pcbnew/router/pns_meander_placer.cpp index bfc4ee0bef..c9ad4d4a88 100644 --- a/pcbnew/router/pns_meander_placer.cpp +++ b/pcbnew/router/pns_meander_placer.cpp @@ -159,6 +159,8 @@ bool MEANDER_PLACER::doMove( const VECTOR2I& aP, ITEM* aEndItem, long long int a if( const LINE* l = dyn_cast( item ) ) { PNS_DBG( Dbg(), AddItem, l, BLUE, 30000, wxT( "tuned-line" ) ); + + m_router->GetInterface()->DisplayPathLine( l->CLine(), 1 ); } } diff --git a/pcbnew/router/pns_meander_skew_placer.cpp b/pcbnew/router/pns_meander_skew_placer.cpp index e7d8a18eba..f6e1a854ce 100644 --- a/pcbnew/router/pns_meander_skew_placer.cpp +++ b/pcbnew/router/pns_meander_skew_placer.cpp @@ -138,16 +138,26 @@ long long int MEANDER_SKEW_PLACER::currentSkew() const bool MEANDER_SKEW_PLACER::Move( const VECTOR2I& aP, ITEM* aEndItem ) { + bool isPositive = m_originPair.NetP() == m_originLine.Net(); + for( const ITEM* item : m_tunedPathP.CItems() ) { if( const LINE* l = dyn_cast( item ) ) + { PNS_DBG( Dbg(), AddItem, l, BLUE, 10000, wxT( "tuned-path-skew-p" ) ); + + m_router->GetInterface()->DisplayPathLine( l->CLine(), isPositive ? 1 : 0 ); + } } for( const ITEM* item : m_tunedPathN.CItems() ) { if( const LINE* l = dyn_cast( item ) ) + { PNS_DBG( Dbg(), AddItem, l, YELLOW, 10000, wxT( "tuned-path-skew-n" ) ); + + m_router->GetInterface()->DisplayPathLine( l->CLine(), isPositive ? 0 : 1 ); + } } return doMove( aP, aEndItem, m_coupledLength + m_settings.m_targetSkew ); diff --git a/pcbnew/router/pns_router.h b/pcbnew/router/pns_router.h index 7975e64d68..6abb28178b 100644 --- a/pcbnew/router/pns_router.h +++ b/pcbnew/router/pns_router.h @@ -97,6 +97,7 @@ enum DRAG_MODE virtual bool IsItemVisible( const PNS::ITEM* aItem ) const = 0; virtual bool IsFlashedOnLayer( const PNS::ITEM* aItem, int aLayer ) const = 0; virtual void DisplayItem( const ITEM* aItem, int aClearance, bool aEdit = false, bool aIsHeadTrace = false ) = 0; + virtual void DisplayPathLine( const SHAPE_LINE_CHAIN& aLine, int aImportance ) = 0; virtual void DisplayRatline( const SHAPE_LINE_CHAIN& aRatline, int aNetCode ) = 0; virtual void HideItem( ITEM* aItem ) = 0; virtual void Commit() = 0; diff --git a/pcbnew/router/router_preview_item.cpp b/pcbnew/router/router_preview_item.cpp index f93ec4e2eb..0604d8532f 100644 --- a/pcbnew/router/router_preview_item.cpp +++ b/pcbnew/router/router_preview_item.cpp @@ -211,7 +211,7 @@ void ROUTER_PREVIEW_ITEM::drawLineChain( const SHAPE_LINE_CHAIN_BASE* aL, KIGFX: gal->DrawArc( arc.GetCenter(), arc.GetRadius(), start_angle, start_angle + angle); } - if( aL->IsClosed() ) + if( aL && aL->IsClosed() ) gal->DrawLine( aL->GetSegment( -1 ).B, aL->GetSegment( 0 ).A ); } @@ -500,3 +500,4 @@ const COLOR4D ROUTER_PREVIEW_ITEM::assignColor( int aStyle ) const const int ROUTER_PREVIEW_ITEM::ClearanceOverlayDepth = -VIEW::VIEW_MAX_LAYERS - 10; const int ROUTER_PREVIEW_ITEM::BaseOverlayDepth = -VIEW::VIEW_MAX_LAYERS - 20; const int ROUTER_PREVIEW_ITEM::ViaOverlayDepth = -VIEW::VIEW_MAX_LAYERS - 50; +const int ROUTER_PREVIEW_ITEM::PathOverlayDepth = -VIEW::VIEW_MAX_LAYERS - 55; diff --git a/pcbnew/router/router_preview_item.h b/pcbnew/router/router_preview_item.h index 966328a5ae..6385c7dda9 100644 --- a/pcbnew/router/router_preview_item.h +++ b/pcbnew/router/router_preview_item.h @@ -55,6 +55,12 @@ public: PR_SHAPE }; + // fixme: shouldn't this go to VIEW? + static const int ClearanceOverlayDepth; + static const int BaseOverlayDepth; + static const int ViaOverlayDepth; + static const int PathOverlayDepth; + ROUTER_PREVIEW_ITEM( const SHAPE& aShape, KIGFX::VIEW* aView = nullptr); ROUTER_PREVIEW_ITEM( const PNS::ITEM* aItem = nullptr, KIGFX::VIEW* aView = nullptr); ~ROUTER_PREVIEW_ITEM(); @@ -136,11 +142,6 @@ private: int m_clearance; bool m_showClearance; - // fixme: shouldn't this go to VIEW? - static const int ClearanceOverlayDepth; - static const int BaseOverlayDepth; - static const int ViaOverlayDepth; - double m_depth; KIGFX::COLOR4D m_color;