From c9be096e88fe91b4646463a758f0c3503e166477 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sun, 10 Feb 2013 19:02:45 +0100 Subject: [PATCH] eeschema, libedit l fix a bug in lib_arc.cpp which creates incorrect arc start and arc end parameters after rotation or mirror. the Bug #1121079 is due to this bug, but Bug #1121079 itself cannot be fixed because this is the data inside the lib which is broken. --- eeschema/lib_arc.cpp | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/eeschema/lib_arc.cpp b/eeschema/lib_arc.cpp index ce2752a30a..2673290c61 100644 --- a/eeschema/lib_arc.cpp +++ b/eeschema/lib_arc.cpp @@ -293,6 +293,19 @@ void LIB_ARC::MirrorHorizontal( const wxPoint& aCenter ) m_ArcEnd.x *= -1; m_ArcEnd.x += aCenter.x; EXCHG( m_ArcStart, m_ArcEnd ); + EXCHG( m_t1, m_t2 ); + m_t1 = 1800 - m_t1; + m_t2 = 1800 - m_t2; + if( m_t1 > 3600 || m_t2 > 3600 ) + { + m_t1 -= 3600; + m_t2 -= 3600; + } + else if( m_t1 < -3600 || m_t2 < -3600 ) + { + m_t1 += 3600; + m_t2 += 3600; + } } void LIB_ARC::MirrorVertical( const wxPoint& aCenter ) @@ -307,6 +320,19 @@ void LIB_ARC::MirrorVertical( const wxPoint& aCenter ) m_ArcEnd.y *= -1; m_ArcEnd.y += aCenter.y; EXCHG( m_ArcStart, m_ArcEnd ); + EXCHG( m_t1, m_t2 ); + m_t1 = - m_t1; + m_t2 = - m_t2; + if( m_t1 > 3600 || m_t2 > 3600 ) + { + m_t1 -= 3600; + m_t2 -= 3600; + } + else if( m_t1 < -3600 || m_t2 < -3600 ) + { + m_t1 += 3600; + m_t2 += 3600; + } } void LIB_ARC::Rotate( const wxPoint& aCenter, bool aRotateCCW ) @@ -315,6 +341,18 @@ void LIB_ARC::Rotate( const wxPoint& aCenter, bool aRotateCCW ) RotatePoint( &m_Pos, aCenter, rot_angle ); RotatePoint( &m_ArcStart, aCenter, rot_angle ); RotatePoint( &m_ArcEnd, aCenter, rot_angle ); + m_t1 -= rot_angle; + m_t2 -= rot_angle; + if( m_t1 > 3600 || m_t2 > 3600 ) + { + m_t1 -= 3600; + m_t2 -= 3600; + } + else if( m_t1 < -3600 || m_t2 < -3600 ) + { + m_t1 += 3600; + m_t2 += 3600; + } }