router: mark the head trace (as opposed to the 'fixed tail') with fully saturated color

Fixes https://gitlab.com/kicad/code/kicad/-/issues/11386
This commit is contained in:
Tomasz Wlostowski 2022-12-29 13:12:27 +01:00
parent dfb1068358
commit 7d40bbdf38
9 changed files with 34 additions and 17 deletions

View File

@ -613,7 +613,9 @@ bool PCB_VIA::FlashLayer( int aLayer ) const
return false; return false;
if( !m_removeUnconnectedLayer ) if( !m_removeUnconnectedLayer )
{
return true; return true;
}
if( m_keepStartEndLayer && ( aLayer == m_layer || aLayer == m_bottomLayer ) ) if( m_keepStartEndLayer && ( aLayer == m_layer || aLayer == m_bottomLayer ) )
return true; return true;

View File

@ -1228,7 +1228,7 @@ bool PNS_KICAD_IFACE_BASE::syncTextItem( PNS::NODE* aWorld, EDA_TEXT* aText, PCB
solid->SetShape( rectShape ); solid->SetShape( rectShape );
} }
else else
solid->SetShape( aText->GetEffectiveTextShape()->Clone() ); solid->SetShape( aText->GetEffectiveTextShape()->Clone() );
solid->SetRoutable( false ); solid->SetRoutable( false );
@ -1253,7 +1253,7 @@ bool PNS_KICAD_IFACE_BASE::syncTextItem( PNS::NODE* aWorld, EDA_TEXT* aText, PCB
solid->SetRoutable( false ); solid->SetRoutable( false );
aWorld->Add( std::move( solid ) ); aWorld->Add( std::move( solid ) );
return true; return true;
*/ */
} }
@ -1516,7 +1516,7 @@ void PNS_KICAD_IFACE_BASE::SetDebugDecorator( PNS::DEBUG_DECORATOR *aDec )
} }
void PNS_KICAD_IFACE::DisplayItem( const PNS::ITEM* aItem, int aClearance, bool aEdit ) void PNS_KICAD_IFACE::DisplayItem( const PNS::ITEM* aItem, int aClearance, bool aEdit, bool aIsHeadTrace )
{ {
if( aItem->IsVirtual() ) if( aItem->IsVirtual() )
return; return;
@ -1554,6 +1554,12 @@ void PNS_KICAD_IFACE::DisplayItem( const PNS::ITEM* aItem, int aClearance, bool
} }
} }
if( aIsHeadTrace )
{
pitem->SetIsHeadTrace( true );
pitem->Update( aItem );
}
m_previewItems->Add( pitem ); m_previewItems->Add( pitem );
m_view->Update( m_previewItems ); m_view->Update( m_previewItems );
} }

View File

@ -59,7 +59,7 @@ public:
bool IsFlashedOnLayer( const PNS::ITEM* aItem, int aLayer ) const override; bool IsFlashedOnLayer( const PNS::ITEM* aItem, int aLayer ) const override;
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 ) override {} void DisplayItem( const PNS::ITEM* aItem, int aClearance, bool aEdit = false, bool aIsHeadTrace = false ) 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;
@ -115,7 +115,7 @@ public:
bool IsAnyLayerVisible( const LAYER_RANGE& aLayer ) const override; bool IsAnyLayerVisible( const LAYER_RANGE& aLayer ) const override;
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 ) override; void DisplayItem( const PNS::ITEM* aItem, int aClearance, bool aEdit = false, bool aIsHeadTrace = false ) 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

@ -750,7 +750,7 @@ bool ROUTER::movePlacing( const VECTOR2I& aP, ITEM* aEndItem )
const LINE* l = static_cast<const LINE*>( item ); const LINE* l = static_cast<const LINE*>( item );
int clearance = GetRuleResolver()->Clearance( item, nullptr ); int clearance = GetRuleResolver()->Clearance( item, nullptr );
m_iface->DisplayItem( l, clearance ); m_iface->DisplayItem( l, clearance, false, true );
if( l->EndsWithVia() ) if( l->EndsWithVia() )
{ {
@ -761,7 +761,7 @@ bool ROUTER::movePlacing( const VECTOR2I& aP, ITEM* aEndItem )
if( holeClearance + via.Drill() / 2 > viaClearance + via.Diameter() / 2 ) if( holeClearance + via.Drill() / 2 > viaClearance + via.Diameter() / 2 )
viaClearance = holeClearance + via.Drill() / 2 - via.Diameter() / 2; viaClearance = holeClearance + via.Drill() / 2 - via.Diameter() / 2;
m_iface->DisplayItem( &l->Via(), viaClearance ); m_iface->DisplayItem( &l->Via(), viaClearance, false, true );
} }
} }

View File

@ -96,7 +96,7 @@ enum DRAG_MODE
virtual bool IsAnyLayerVisible( const LAYER_RANGE& aLayer ) const = 0; virtual bool IsAnyLayerVisible( const LAYER_RANGE& aLayer ) const = 0;
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 ) = 0; virtual void DisplayItem( const ITEM* aItem, int aClearance, bool aEdit = false, bool aIsHeadTrace = false ) = 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

@ -51,11 +51,10 @@ ROUTER_PREVIEW_ITEM::ROUTER_PREVIEW_ITEM( const PNS::ITEM* aItem, KIGFX::VIEW* a
m_showClearance = false; m_showClearance = false;
// initialize variables, overwritten by Update( aItem ), if aItem != NULL // initialize variables, overwritten by Update( aItem ), if aItem != NULL
m_router = nullptr;
m_type = PR_SHAPE; m_type = PR_SHAPE;
m_style = 0;
m_width = 0; m_width = 0;
m_depth = 0; m_depth = 0;
m_isHeadTrace = false;
if( aItem ) if( aItem )
Update( aItem ); Update( aItem );
@ -76,11 +75,10 @@ ROUTER_PREVIEW_ITEM::ROUTER_PREVIEW_ITEM( const SHAPE& aShape, KIGFX::VIEW* aVie
m_showClearance = false; m_showClearance = false;
// initialize variables, overwritten by Update( aItem ), if aItem != NULL // initialize variables, overwritten by Update( aItem ), if aItem != NULL
m_router = nullptr;
m_type = PR_SHAPE; m_type = PR_SHAPE;
m_style = 0;
m_width = 0; m_width = 0;
m_depth = 0; m_depth = 0;
m_isHeadTrace = false;
} }
@ -468,7 +466,14 @@ const COLOR4D ROUTER_PREVIEW_ITEM::getLayerColor( int aLayer ) const
{ {
auto settings = static_cast<PCB_RENDER_SETTINGS*>( m_view->GetPainter()->GetSettings() ); auto settings = static_cast<PCB_RENDER_SETTINGS*>( m_view->GetPainter()->GetSettings() );
return settings->GetLayerColor( aLayer ); COLOR4D color = settings->GetLayerColor( aLayer );
if( m_isHeadTrace )
{
return color.Saturate( 1.0 );
}
return color;
} }

View File

@ -76,6 +76,11 @@ public:
m_showClearance = aEnabled; m_showClearance = aEnabled;
} }
void SetIsHeadTrace( bool aIsHead )
{
m_isHeadTrace = aIsHead;
}
#if defined(DEBUG) #if defined(DEBUG)
void Show( int aA, std::ostream& aB ) const override {} void Show( int aA, std::ostream& aB ) const override {}
#endif #endif
@ -109,13 +114,12 @@ private:
private: private:
KIGFX::VIEW* m_view; KIGFX::VIEW* m_view;
PNS::ROUTER* m_router;
SHAPE* m_shape; SHAPE* m_shape;
SHAPE* m_hole; SHAPE* m_hole;
ITEM_TYPE m_type; ITEM_TYPE m_type;
int m_style; bool m_isHeadTrace;
int m_width; int m_width;
int m_layer; int m_layer;
int m_originLayer; int m_originLayer;

View File

@ -262,7 +262,7 @@ void PNS_LOG_PLAYER_KICAD_IFACE::HideItem( PNS::ITEM* aItem )
m_viewTracker->HideItem( aItem ); m_viewTracker->HideItem( aItem );
} }
void PNS_LOG_PLAYER_KICAD_IFACE::DisplayItem( const PNS::ITEM* aItem, int aClearance, bool aEdit ) void PNS_LOG_PLAYER_KICAD_IFACE::DisplayItem( const PNS::ITEM* aItem, int aClearance, bool aEdit, bool aIsHeadTrace )
{ {
//printf("DBG disp %p\n", aItem); //printf("DBG disp %p\n", aItem);
m_viewTracker->DisplayItem( aItem ); m_viewTracker->DisplayItem( aItem );

View File

@ -69,7 +69,7 @@ public:
~PNS_LOG_PLAYER_KICAD_IFACE(); ~PNS_LOG_PLAYER_KICAD_IFACE();
void HideItem( PNS::ITEM* aItem ) override; void HideItem( PNS::ITEM* aItem ) override;
void DisplayItem( const PNS::ITEM* aItem, int aClearance, bool aEdit = false ) override; void DisplayItem( const PNS::ITEM* aItem, int aClearance, bool aEdit = false, bool aIsHeadTrace = false ) override;
private: private:
PNS_LOG_VIEW_TRACKER *m_viewTracker; PNS_LOG_VIEW_TRACKER *m_viewTracker;