Draw ratsnest with colors if color data is available

This commit is contained in:
Jon Evans 2020-07-10 21:37:53 -04:00
parent 72b08f2b18
commit d248736f08
2 changed files with 12 additions and 7 deletions

View File

@ -238,8 +238,6 @@ void PCB_RENDER_SETTINGS::LoadNetSettings( const NET_SETTINGS& aSettings, const
} }
m_hiddenNets = aHiddenNets; m_hiddenNets = aHiddenNets;
} }

View File

@ -84,7 +84,7 @@ void RATSNEST_VIEWITEM::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const
std::set<int> highlightedNets = rs->GetHighlightNetCodes(); std::set<int> highlightedNets = rs->GetHighlightNetCodes();
const std::set<int>& hiddenNets = rs->GetHiddenNets(); const std::set<int>& hiddenNets = rs->GetHiddenNets();
gal->SetStrokeColor( color.Brightened(0.5) ); std::map<int, KIGFX::COLOR4D>& netColors = rs->GetNetColorMap();
const bool curved_ratsnest = rs->GetCurvedRatsnestLinesEnabled(); const bool curved_ratsnest = rs->GetCurvedRatsnestLinesEnabled();
@ -94,6 +94,13 @@ void RATSNEST_VIEWITEM::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const
if( hiddenNets.count( l.netCode ) ) if( hiddenNets.count( l.netCode ) )
continue; continue;
if( colorByNet && netColors.count( l.netCode ) )
color = netColors.at( l.netCode );
else
color = defaultColor;
gal->SetStrokeColor( color.Brightened( 0.5 ) );
if ( l.a == l.b ) if ( l.a == l.b )
{ {
gal->DrawLine( VECTOR2I( l.a.x - CROSS_SIZE, l.a.y - CROSS_SIZE ), gal->DrawLine( VECTOR2I( l.a.x - CROSS_SIZE, l.a.y - CROSS_SIZE ),
@ -128,10 +135,10 @@ void RATSNEST_VIEWITEM::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const
if( !net ) if( !net )
continue; continue;
if( colorByNet ) if( colorByNet && netColors.count( i ) )
{ color = netColors.at( i );
// TODO(JE) - RN_NET to net name / netclass name link else
} color = defaultColor;
// Draw the "static" ratsnest // Draw the "static" ratsnest
if( highlightedNets.count( i ) ) if( highlightedNets.count( i ) )