pcbnew: Draw dynamic ratsnest with curved lines

When selected, curved ratsnest lines can be used for all ratsnest not
just the static set.

Fixes: lp:1832929
* https://bugs.launchpad.net/kicad/+bug/1832929
This commit is contained in:
Seth Hillbrand 2019-06-15 08:16:38 -07:00
parent 79e2000af4
commit 4f4b24a638
1 changed files with 20 additions and 8 deletions

View File

@ -2,7 +2,7 @@
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 2013 CERN
* Copyright (C) 2018 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2018-2019 KiCad Developers, see AUTHORS.txt for contributors.
*
* @author Maciej Suminski <maciej.suminski@cern.ch>
*
@ -93,7 +93,18 @@ void RATSNEST_VIEWITEM::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const
}
else
{
gal->DrawLine( l.a, l.b );
if( curved_ratsnest )
{
auto dx = l.b.x - l.a.x;
auto dy = l.b.y - l.a.y;
const auto center = VECTOR2I( l.a.x + 0.5 * dx - 0.1 * dy,
l.a.y + 0.5 * dy + 0.1 * dx );
gal->DrawCurve( l.a, center, center, l.b );
}
else
{
gal->DrawLine( l.a, l.b );
}
}
}
@ -148,15 +159,16 @@ void RATSNEST_VIEWITEM::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const
}
else
{
if (curved_ratsnest) {
if( curved_ratsnest )
{
auto dx = target.x - source.x;
auto dy = target.y - source.y;
const auto center = VECTOR2I(
source.x + 0.5 * dx - 0.1 * dy,
source.y + 0.5 * dy + 0.1 * dx
);
const auto center = VECTOR2I( source.x + 0.5 * dx - 0.1 * dy,
source.y + 0.5 * dy + 0.1 * dx );
gal->DrawCurve( source, center, center, target );
} else {
}
else
{
gal->DrawLine( source, target );
}
}