router: Re-add electrical path lines drawing for length tuning.

This commit is contained in:
Alex 2023-02-01 20:36:52 +03:00
parent 5b9b555fdf
commit 6543d23d9f
8 changed files with 50 additions and 6 deletions

View File

@ -224,13 +224,21 @@ bool DP_MEANDER_PLACER::Move( const VECTOR2I& aP, ITEM* aEndItem )
for( const ITEM* item : m_tunedPathP.CItems() ) for( const ITEM* item : m_tunedPathP.CItems() )
{ {
if( const LINE* l = dyn_cast<const LINE*>( item ) ) if( const LINE* l = dyn_cast<const LINE*>( item ) )
{
PNS_DBG( Dbg(), AddShape, &l->CLine(), YELLOW, 10000, wxT( "tuned-path-p" ) ); 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() ) for( const ITEM* item : m_tunedPathN.CItems() )
{ {
if( const LINE* l = dyn_cast<const LINE*>( item ) ) if( const LINE* l = dyn_cast<const LINE*>( item ) )
{
PNS_DBG( Dbg(), AddShape, &l->CLine(), YELLOW, 10000, wxT( "tuned-path-n" ) ); PNS_DBG( Dbg(), AddShape, &l->CLine(), YELLOW, 10000, wxT( "tuned-path-n" ) );
m_router->GetInterface()->DisplayPathLine( l->CLine(), 1 );
}
} }
int curIndexP = 0, curIndexN = 0; int curIndexP = 0, curIndexN = 0;

View File

@ -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 ) void PNS_KICAD_IFACE::DisplayRatline( const SHAPE_LINE_CHAIN& aRatline, int aNetCode )
{ {
ROUTER_PREVIEW_ITEM* pitem = new ROUTER_PREVIEW_ITEM( aRatline, m_view ); ROUTER_PREVIEW_ITEM* pitem = new ROUTER_PREVIEW_ITEM( aRatline, m_view );

View File

@ -60,6 +60,7 @@ public:
bool IsItemVisible( const PNS::ITEM* aItem ) const override { return true; }; bool IsItemVisible( const PNS::ITEM* aItem ) const override { return true; };
void HideItem( PNS::ITEM* aItem ) override {} void HideItem( PNS::ITEM* aItem ) override {}
void DisplayItem( const PNS::ITEM* aItem, int aClearance, bool aEdit = false, bool aIsHeadTrace = false ) 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 DisplayRatline( const SHAPE_LINE_CHAIN& aRatline, int aNetCode ) override {}
void AddItem( PNS::ITEM* aItem ) override; void AddItem( PNS::ITEM* aItem ) override;
void UpdateItem( PNS::ITEM* aItem ) override; void UpdateItem( PNS::ITEM* aItem ) override;
@ -116,6 +117,7 @@ public:
bool IsItemVisible( const PNS::ITEM* aItem ) const override; bool IsItemVisible( const PNS::ITEM* aItem ) const override;
void HideItem( PNS::ITEM* aItem ) override; void HideItem( PNS::ITEM* aItem ) override;
void DisplayItem( const PNS::ITEM* aItem, int aClearance, bool aEdit = false, bool aIsHeadTrace = false ) 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 DisplayRatline( const SHAPE_LINE_CHAIN& aRatline, int aNetCode ) override;
void Commit() override; void Commit() override;
void AddItem( PNS::ITEM* aItem ) override; void AddItem( PNS::ITEM* aItem ) override;

View File

@ -159,6 +159,8 @@ bool MEANDER_PLACER::doMove( const VECTOR2I& aP, ITEM* aEndItem, long long int a
if( const LINE* l = dyn_cast<const LINE*>( item ) ) if( const LINE* l = dyn_cast<const LINE*>( item ) )
{ {
PNS_DBG( Dbg(), AddItem, l, BLUE, 30000, wxT( "tuned-line" ) ); PNS_DBG( Dbg(), AddItem, l, BLUE, 30000, wxT( "tuned-line" ) );
m_router->GetInterface()->DisplayPathLine( l->CLine(), 1 );
} }
} }

View File

@ -138,16 +138,26 @@ long long int MEANDER_SKEW_PLACER::currentSkew() const
bool MEANDER_SKEW_PLACER::Move( const VECTOR2I& aP, ITEM* aEndItem ) 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() ) for( const ITEM* item : m_tunedPathP.CItems() )
{ {
if( const LINE* l = dyn_cast<const LINE*>( item ) ) if( const LINE* l = dyn_cast<const LINE*>( item ) )
{
PNS_DBG( Dbg(), AddItem, l, BLUE, 10000, wxT( "tuned-path-skew-p" ) ); 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() ) for( const ITEM* item : m_tunedPathN.CItems() )
{ {
if( const LINE* l = dyn_cast<const LINE*>( item ) ) if( const LINE* l = dyn_cast<const LINE*>( item ) )
{
PNS_DBG( Dbg(), AddItem, l, YELLOW, 10000, wxT( "tuned-path-skew-n" ) ); 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 ); return doMove( aP, aEndItem, m_coupledLength + m_settings.m_targetSkew );

View File

@ -97,6 +97,7 @@ enum DRAG_MODE
virtual bool IsItemVisible( const PNS::ITEM* aItem ) const = 0; virtual bool IsItemVisible( const PNS::ITEM* aItem ) const = 0;
virtual bool IsFlashedOnLayer( const PNS::ITEM* aItem, int aLayer ) 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 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 DisplayRatline( const SHAPE_LINE_CHAIN& aRatline, int aNetCode ) = 0;
virtual void HideItem( ITEM* aItem ) = 0; virtual void HideItem( ITEM* aItem ) = 0;
virtual void Commit() = 0; virtual void Commit() = 0;

View File

@ -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); 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 ); 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::ClearanceOverlayDepth = -VIEW::VIEW_MAX_LAYERS - 10;
const int ROUTER_PREVIEW_ITEM::BaseOverlayDepth = -VIEW::VIEW_MAX_LAYERS - 20; 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::ViaOverlayDepth = -VIEW::VIEW_MAX_LAYERS - 50;
const int ROUTER_PREVIEW_ITEM::PathOverlayDepth = -VIEW::VIEW_MAX_LAYERS - 55;

View File

@ -55,6 +55,12 @@ public:
PR_SHAPE 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 SHAPE& aShape, KIGFX::VIEW* aView = nullptr);
ROUTER_PREVIEW_ITEM( const PNS::ITEM* aItem = nullptr, KIGFX::VIEW* aView = nullptr); ROUTER_PREVIEW_ITEM( const PNS::ITEM* aItem = nullptr, KIGFX::VIEW* aView = nullptr);
~ROUTER_PREVIEW_ITEM(); ~ROUTER_PREVIEW_ITEM();
@ -136,11 +142,6 @@ private:
int m_clearance; int m_clearance;
bool m_showClearance; 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; double m_depth;
KIGFX::COLOR4D m_color; KIGFX::COLOR4D m_color;