Make printing/plotting/drawing of LIB and SCH arcs consistent.

Fixes https://gitlab.com/kicad/code/kicad/issues/10801
This commit is contained in:
Jeff Young 2022-02-10 00:33:31 +00:00
parent 3f36e7d725
commit 7b84e0a7d9
2 changed files with 16 additions and 20 deletions

View File

@ -139,6 +139,15 @@ void LIB_SHAPE::Plot( PLOTTER* aPlotter, const VECTOR2I& aOffset, bool aFill,
for( const VECTOR2I& pt : m_bezierPoints )
cornerList.push_back( aTransform.TransformCoordinate( pt ) + aOffset );
}
else if( GetShape() == SHAPE_T::ARC )
{
EDA_ANGLE t1, t2;
CalcArcAngles( t1, t2 );
if( aTransform.MapAngles( &t1, &t2 ) != ( ( t1 - t2 ).Normalize180() > ANGLE_0 ) )
std::swap( start, end );
}
if( fill != FILL_T::NO_FILL )
{

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2004-2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2004-2022 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -207,9 +207,6 @@ void SCH_SHAPE::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset
{
int penWidth = GetPenWidth();
wxDC* DC = aSettings->GetPrintDC();
VECTOR2I pt1 = GetStart();
VECTOR2I pt2 = GetEnd();
VECTOR2I c;
COLOR4D color;
penWidth = std::max( penWidth, aSettings->GetMinPenWidth() );
@ -235,16 +232,6 @@ void SCH_SHAPE::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset
for( size_t ii = 0; ii < ptCount; ++ii )
buffer[ii] = m_bezierPoints[ii];
}
else if( GetShape() == SHAPE_T::ARC )
{
c = getCenter();
EDA_ANGLE t1, t2;
CalcArcAngles( t1, t2 );
if( ( t1 - t2 ).Normalize180() > ANGLE_0 )
std::swap( pt1, pt2 );
}
if( GetFillMode() == FILL_T::FILLED_WITH_COLOR )
{
@ -253,15 +240,15 @@ void SCH_SHAPE::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset
switch( GetShape() )
{
case SHAPE_T::ARC:
GRFilledArc( DC, pt1, pt2, c, 0, color, color );
GRFilledArc( DC, GetEnd(), GetStart(), getCenter(), 0, color, color );
break;
case SHAPE_T::CIRCLE:
GRFilledCircle( DC, pt1, GetRadius(), 0, color, color );
GRFilledCircle( DC, GetStart(), GetRadius(), 0, color, color );
break;
case SHAPE_T::RECT:
GRFilledRect( DC, pt1, pt2, 0, color, color );
GRFilledRect( DC, GetStart(), GetEnd(), 0, color, color );
break;
case SHAPE_T::POLY:
@ -287,15 +274,15 @@ void SCH_SHAPE::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset
switch( GetShape() )
{
case SHAPE_T::ARC:
GRArc( DC, pt1, pt2, c, penWidth, color );
GRArc( DC, GetEnd(), GetStart(), getCenter(), penWidth, color );
break;
case SHAPE_T::CIRCLE:
GRCircle( DC, pt1, GetRadius(), penWidth, color );
GRCircle( DC, GetStart(), GetRadius(), penWidth, color );
break;
case SHAPE_T::RECT:
GRRect( DC, pt1, pt2, penWidth, color );
GRRect( DC, GetStart(), GetEnd(), penWidth, color );
break;
case SHAPE_T::POLY: