eeschema: Properly map edge cases of legacy onto GAL
While we do not generate these arcs internally, some external tools
generate arcs that are technically valid but display correctly only
because of an oddity in the degeneracy mapping.
Fixes: lp:1838557
* https://bugs.launchpad.net/kicad/+bug/1838557
(cherry picked from commit cf949609b2
)
This commit is contained in:
parent
8789ab9265
commit
643c7f25f5
|
@ -435,8 +435,27 @@ void SCH_PAINTER::draw( LIB_ARC *aArc, int aLayer )
|
|||
int sai = aArc->GetFirstRadiusAngle();
|
||||
int eai = aArc->GetSecondRadiusAngle();
|
||||
|
||||
if( TRANSFORM().MapAngles( &sai, &eai ) )
|
||||
std::swap( sai, eai );
|
||||
/**
|
||||
* This accounts for an oddity in the old library format, where the symbol
|
||||
* is overdefined. The previous draw (based on wxwidgets) used start point and end
|
||||
* point and always drew counter-clockwise. The new GAL draw takes center, radius and
|
||||
* start/end angles. All of these points were stored in the file, so we need to mimic the
|
||||
* swapping of start/end points rather than using the stored angles in order to properly map
|
||||
* edge cases.
|
||||
*
|
||||
* todo(v6): Remove this hack when we update the file format and do translation on loading.
|
||||
*/
|
||||
if( !TRANSFORM().MapAngles( &sai, &eai ) )
|
||||
{
|
||||
LIB_ARC new_arc( *aArc );
|
||||
|
||||
new_arc.SetStart( aArc->GetEnd() );
|
||||
new_arc.SetEnd( aArc->GetStart() );
|
||||
new_arc.CalcRadiusAngles();
|
||||
sai = new_arc.GetFirstRadiusAngle();
|
||||
eai = new_arc.GetSecondRadiusAngle();
|
||||
TRANSFORM().MapAngles( &sai, &eai );
|
||||
}
|
||||
|
||||
double sa = (double) sai * M_PI / 1800.0;
|
||||
double ea = (double) eai * M_PI / 1800.0 ;
|
||||
|
|
Loading…
Reference in New Issue