More careful check on the net number while drawing net labels for tracks.

This commit is contained in:
Maciej Suminski 2013-09-16 11:08:31 +02:00
parent 573f9841df
commit 8a1c97ea56
1 changed files with 4 additions and 1 deletions

View File

@ -273,7 +273,7 @@ void PCB_PAINTER::draw( const TRACK* aTrack, int aLayer )
if( m_pcbSettings->m_netNamesOnTracks && IsNetnameLayer( aLayer ) ) if( m_pcbSettings->m_netNamesOnTracks && IsNetnameLayer( aLayer ) )
{ {
// If there is a net name - display it on the track // If there is a net name - display it on the track
if( netNumber != 0 ) if( netNumber > 0 )
{ {
VECTOR2D line = ( end - start ); VECTOR2D line = ( end - start );
double length = line.EuclideanNorm(); double length = line.EuclideanNorm();
@ -283,6 +283,9 @@ void PCB_PAINTER::draw( const TRACK* aTrack, int aLayer )
return; return;
NETINFO_ITEM* net = ( (BOARD*) aTrack->GetParent() )->FindNet( netNumber ); NETINFO_ITEM* net = ( (BOARD*) aTrack->GetParent() )->FindNet( netNumber );
if( net == NULL )
return;
std::string netName = std::string( net->GetShortNetname().mb_str() ); std::string netName = std::string( net->GetShortNetname().mb_str() );
VECTOR2D textPosition = start + line / 2.0; // center of the track VECTOR2D textPosition = start + line / 2.0; // center of the track
double textOrientation = -atan( line.y / line.x ); double textOrientation = -atan( line.y / line.x );