Simplify rotation code.

This commit is contained in:
Jeff Young 2024-05-12 23:22:13 +01:00
parent 20cde51b43
commit 6cc534182a
3 changed files with 2 additions and 28 deletions

View File

@ -412,29 +412,14 @@ void SCH_LINE::MirrorHorizontally( int aCenter )
void SCH_LINE::Rotate( const VECTOR2I& aCenter, bool aRotateCCW )
{
// When we allow off grid items, the
// else if should become a plain if to allow
// rotation around the center of the line
if( m_flags & STARTPOINT )
RotatePoint( m_start, aCenter, aRotateCCW ? ANGLE_90 : ANGLE_270 );
else if( m_flags & ENDPOINT )
if( m_flags & ENDPOINT )
RotatePoint( m_end, aCenter, aRotateCCW ? ANGLE_90 : ANGLE_270 );
}
void SCH_LINE::RotateStart( const VECTOR2I& aCenter )
{
RotatePoint( m_start, aCenter, ANGLE_90 );
}
void SCH_LINE::RotateEnd( const VECTOR2I& aCenter )
{
RotatePoint( m_end, aCenter, ANGLE_90 );
}
int SCH_LINE::GetAngleFrom( const VECTOR2I& aPoint ) const
{
VECTOR2I vec;

View File

@ -211,8 +211,6 @@ public:
void MirrorVertically( int aCenter ) override;
void MirrorHorizontally( int aCenter ) override;
void Rotate( const VECTOR2I& aCenter, bool aRotateCCW ) override;
void RotateStart( const VECTOR2I& aCenter );
void RotateEnd( const VECTOR2I& aCenter );
/**
* Check line against \a aLine to see if it overlaps and merge if it does.

View File

@ -841,16 +841,7 @@ int SCH_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
{
SCH_LINE* line = (SCH_LINE*) item;
for( int i = 0; clockwise ? i < 3 : i < 1; ++i )
{
// If we are rotating more than one item, we do not have start/end
// points separately selected
if( item->HasFlag( STARTPOINT ) )
line->RotateStart( rotPoint );
if( item->HasFlag( ENDPOINT ) )
line->RotateEnd( rotPoint );
}
line->Rotate( rotPoint, !clockwise );
}
else if( item->Type() == SCH_SHEET_PIN_T )
{