Harmonize rotate APIs.
This commit is contained in:
parent
441b2686d3
commit
c5ed80af52
|
@ -162,10 +162,10 @@ void SCH_BITMAP::MirrorHorizontally( int aCenter )
|
|||
}
|
||||
|
||||
|
||||
void SCH_BITMAP::Rotate( const VECTOR2I& aCenter )
|
||||
void SCH_BITMAP::Rotate( const VECTOR2I& aCenter, bool aRotateCCW )
|
||||
{
|
||||
RotatePoint( m_pos, aCenter, ANGLE_90 );
|
||||
m_bitmapBase->Rotate( false );
|
||||
RotatePoint( m_pos, aCenter, aRotateCCW ? ANGLE_270 : ANGLE_90 );
|
||||
m_bitmapBase->Rotate( aRotateCCW );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -133,7 +133,7 @@ public:
|
|||
|
||||
void MirrorHorizontally( int aCenter ) override;
|
||||
void MirrorVertically( int aCenter ) override;
|
||||
void Rotate( const VECTOR2I& aCenter ) override;
|
||||
void Rotate( const VECTOR2I& aCenter, bool aRotateCCW ) override;
|
||||
|
||||
wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override
|
||||
{
|
||||
|
|
|
@ -305,10 +305,10 @@ void SCH_BUS_ENTRY_BASE::MirrorHorizontally( int aCenter )
|
|||
}
|
||||
|
||||
|
||||
void SCH_BUS_ENTRY_BASE::Rotate( const VECTOR2I& aCenter )
|
||||
void SCH_BUS_ENTRY_BASE::Rotate( const VECTOR2I& aCenter, bool aRotateCCW )
|
||||
{
|
||||
RotatePoint( m_pos, aCenter, ANGLE_90 );
|
||||
RotatePoint( &m_size.x, &m_size.y, ANGLE_90 );
|
||||
RotatePoint( m_pos, aCenter, aRotateCCW ? ANGLE_270 : ANGLE_90 );
|
||||
RotatePoint( &m_size.x, &m_size.y, aRotateCCW ? ANGLE_270 : ANGLE_90 );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -102,7 +102,7 @@ public:
|
|||
|
||||
void MirrorHorizontally( int aCenter ) override;
|
||||
void MirrorVertically( int aCenter ) override;
|
||||
void Rotate( const VECTOR2I& aCenter ) override;
|
||||
void Rotate( const VECTOR2I& aCenter, bool aRotateCCW ) override;
|
||||
|
||||
bool IsDangling() const override;
|
||||
|
||||
|
|
|
@ -892,10 +892,10 @@ bool SCH_FIELD::Replace( const EDA_SEARCH_DATA& aSearchData, void* aAuxData )
|
|||
}
|
||||
|
||||
|
||||
void SCH_FIELD::Rotate( const VECTOR2I& aCenter )
|
||||
void SCH_FIELD::Rotate( const VECTOR2I& aCenter, bool aRotateCCW )
|
||||
{
|
||||
VECTOR2I pt = GetPosition();
|
||||
RotatePoint( pt, aCenter, ANGLE_90 );
|
||||
RotatePoint( pt, aCenter, aRotateCCW ? ANGLE_270 : ANGLE_90 );
|
||||
SetPosition( pt );
|
||||
}
|
||||
|
||||
|
|
|
@ -226,7 +226,7 @@ public:
|
|||
Offset( aMoveVector );
|
||||
}
|
||||
|
||||
void Rotate( const VECTOR2I& aCenter ) override;
|
||||
void Rotate( const VECTOR2I& aCenter, bool aRotateCCW ) override;
|
||||
|
||||
/**
|
||||
* @copydoc SCH_ITEM::MirrorVertically()
|
||||
|
|
|
@ -1503,16 +1503,16 @@ void SCH_EASYEDA_PARSER::ParseSchematic( SCHEMATIC* aSchematic, SCH_SHEET* aRoot
|
|||
{
|
||||
// Lines need special handling for some reason
|
||||
aSchItem->SetFlags( STARTPOINT );
|
||||
aSchItem->Rotate( RelPos( cmdAround ) );
|
||||
aSchItem->Rotate( RelPos( cmdAround ), false );
|
||||
aSchItem->ClearFlags( STARTPOINT );
|
||||
|
||||
aSchItem->SetFlags( ENDPOINT );
|
||||
aSchItem->Rotate( RelPos( cmdAround ) );
|
||||
aSchItem->Rotate( RelPos( cmdAround ), false );
|
||||
aSchItem->ClearFlags( ENDPOINT );
|
||||
}
|
||||
else
|
||||
{
|
||||
aSchItem->Rotate( RelPos( cmdAround ) );
|
||||
aSchItem->Rotate( RelPos( cmdAround ), false );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1006,16 +1006,16 @@ void SCH_EASYEDAPRO_PARSER::ParseSchematic( SCHEMATIC* aSchematic, SCH_SHEET* aR
|
|||
{
|
||||
// Lines need special handling for some reason
|
||||
schItem->SetFlags( STARTPOINT );
|
||||
schItem->Rotate( kstart );
|
||||
schItem->Rotate( kstart, false );
|
||||
schItem->ClearFlags( STARTPOINT );
|
||||
|
||||
schItem->SetFlags( ENDPOINT );
|
||||
schItem->Rotate( kstart );
|
||||
schItem->Rotate( kstart, false );
|
||||
schItem->ClearFlags( ENDPOINT );
|
||||
}
|
||||
else
|
||||
{
|
||||
schItem->Rotate( kstart );
|
||||
schItem->Rotate( kstart, false );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1050,7 +1050,7 @@ void SCH_EASYEDAPRO_PARSER::ParseSchematic( SCHEMATIC* aSchematic, SCH_SHEET* aR
|
|||
bitmap->SetPosition( kcenter );
|
||||
|
||||
for( double i = angle; i > 0; i -= 90 )
|
||||
bitmap->Rotate( kstart );
|
||||
bitmap->Rotate( kstart, false );
|
||||
|
||||
if( flipped )
|
||||
bitmap->MirrorHorizontally( kstart.x );
|
||||
|
@ -1129,17 +1129,17 @@ void SCH_EASYEDAPRO_PARSER::ParseSchematic( SCHEMATIC* aSchematic, SCH_SHEET* aR
|
|||
|
||||
wxString unitName = component->name;
|
||||
|
||||
LIB_ID libId =
|
||||
EASYEDAPRO::ToKiCadLibID( aLibName, newLibSymbol.GetLibId().GetLibItemName() );
|
||||
LIB_ID libId = EASYEDAPRO::ToKiCadLibID( aLibName,
|
||||
newLibSymbol.GetLibId().GetLibItemName() );
|
||||
|
||||
std::unique_ptr<SCH_SYMBOL> schSym =
|
||||
std::make_unique<SCH_SYMBOL>( newLibSymbol, libId, &aSchematic->CurrentSheet(),
|
||||
esymInfo.partUnits[unitName] );
|
||||
auto schSym = std::make_unique<SCH_SYMBOL>( newLibSymbol, libId,
|
||||
&aSchematic->CurrentSheet(),
|
||||
esymInfo.partUnits[unitName] );
|
||||
|
||||
schSym->SetFootprintFieldText( newLibSymbol.GetFootprintField().GetText() );
|
||||
|
||||
for( double i = component->rotation; i > 0; i -= 90 )
|
||||
schSym->Rotate( VECTOR2I() );
|
||||
schSym->Rotate( VECTOR2I(), false );
|
||||
|
||||
if( component->mirror )
|
||||
schSym->MirrorHorizontally( 0 );
|
||||
|
|
|
@ -370,18 +370,16 @@ void SCH_IO_LTSPICE_PARSER::RotateMirrorShape( LTSPICE_SCHEMATIC::LT_SYMBOL& aLT
|
|||
{
|
||||
if( aLTSymbol.SymbolOrientation == LTSPICE_SCHEMATIC::ORIENTATION::R90 )
|
||||
{
|
||||
aShape->Rotate( VECTOR2I() );
|
||||
aShape->Rotate( VECTOR2I() );
|
||||
aShape->Rotate( VECTOR2I() );
|
||||
aShape->Rotate( VECTOR2I(), true );
|
||||
}
|
||||
else if( aLTSymbol.SymbolOrientation == LTSPICE_SCHEMATIC::ORIENTATION::R180 )
|
||||
{
|
||||
aShape->Rotate( VECTOR2I() );
|
||||
aShape->Rotate( VECTOR2I() );
|
||||
aShape->Rotate( VECTOR2I(), false );
|
||||
aShape->Rotate( VECTOR2I(), false );
|
||||
}
|
||||
else if( aLTSymbol.SymbolOrientation == LTSPICE_SCHEMATIC::ORIENTATION::R270 )
|
||||
{
|
||||
aShape->Rotate( VECTOR2I() );
|
||||
aShape->Rotate( VECTOR2I(), false );
|
||||
}
|
||||
else if( aLTSymbol.SymbolOrientation == LTSPICE_SCHEMATIC::ORIENTATION::M0 )
|
||||
{
|
||||
|
@ -390,7 +388,7 @@ void SCH_IO_LTSPICE_PARSER::RotateMirrorShape( LTSPICE_SCHEMATIC::LT_SYMBOL& aLT
|
|||
else if( aLTSymbol.SymbolOrientation == LTSPICE_SCHEMATIC::ORIENTATION::M90 )
|
||||
{
|
||||
aShape->MirrorVertically( 0 );
|
||||
aShape->Rotate( VECTOR2I() );
|
||||
aShape->Rotate( VECTOR2I(), false );
|
||||
}
|
||||
else if( aLTSymbol.SymbolOrientation == LTSPICE_SCHEMATIC::ORIENTATION::M180 )
|
||||
{
|
||||
|
@ -399,9 +397,7 @@ void SCH_IO_LTSPICE_PARSER::RotateMirrorShape( LTSPICE_SCHEMATIC::LT_SYMBOL& aLT
|
|||
else if( aLTSymbol.SymbolOrientation == LTSPICE_SCHEMATIC::ORIENTATION::M270 )
|
||||
{
|
||||
aShape->MirrorVertically( 0 );
|
||||
aShape->Rotate( VECTOR2I() );
|
||||
aShape->Rotate( VECTOR2I() );
|
||||
aShape->Rotate( VECTOR2I() );
|
||||
aShape->Rotate( VECTOR2I(), true );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -362,7 +362,7 @@ public:
|
|||
/**
|
||||
* Rotate the item around \a aCenter 90 degrees in the clockwise direction.
|
||||
*/
|
||||
virtual void Rotate( const VECTOR2I& aCenter )
|
||||
virtual void Rotate( const VECTOR2I& aCenter, bool aRotateCCW )
|
||||
{
|
||||
wxCHECK_MSG( false, /*void*/, wxT( "Rotate not implemented in " ) + GetClass() );
|
||||
}
|
||||
|
|
|
@ -139,9 +139,9 @@ void SCH_JUNCTION::MirrorHorizontally( int aCenter )
|
|||
}
|
||||
|
||||
|
||||
void SCH_JUNCTION::Rotate( const VECTOR2I& aCenter )
|
||||
void SCH_JUNCTION::Rotate( const VECTOR2I& aCenter, bool aRotateCCW )
|
||||
{
|
||||
RotatePoint( m_pos, aCenter, ANGLE_90 );
|
||||
RotatePoint( m_pos, aCenter, aRotateCCW ? ANGLE_270 : ANGLE_90 );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ public:
|
|||
|
||||
void MirrorHorizontally( int aCenter ) override;
|
||||
void MirrorVertically( int aCenter ) override;
|
||||
void Rotate( const VECTOR2I& aCenter ) override;
|
||||
void Rotate( const VECTOR2I& aCenter, bool aRotateCCW ) override;
|
||||
|
||||
void GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList ) override;
|
||||
|
||||
|
|
|
@ -425,13 +425,13 @@ void SCH_LABEL_BASE::Move( const VECTOR2I& aMoveVector )
|
|||
}
|
||||
|
||||
|
||||
void SCH_LABEL_BASE::Rotate( const VECTOR2I& aCenter )
|
||||
void SCH_LABEL_BASE::Rotate( const VECTOR2I& aCenter, bool aRotateCCW )
|
||||
{
|
||||
VECTOR2I pt = GetTextPos();
|
||||
RotatePoint( pt, aCenter, ANGLE_90 );
|
||||
RotatePoint( pt, aCenter, aRotateCCW ? ANGLE_270 : ANGLE_90 );
|
||||
VECTOR2I offset = pt - GetTextPos();
|
||||
|
||||
Rotate90( false );
|
||||
Rotate90( aRotateCCW );
|
||||
|
||||
SetTextPos( GetTextPos() + offset );
|
||||
|
||||
|
|
|
@ -222,7 +222,7 @@ public:
|
|||
bool IncrementLabel( int aIncrement );
|
||||
|
||||
void Move( const VECTOR2I& aMoveVector ) override;
|
||||
void Rotate( const VECTOR2I& aCenter ) override;
|
||||
void Rotate( const VECTOR2I& aCenter, bool aRotateCCW ) override;
|
||||
void Rotate90( bool aClockwise ) override;
|
||||
|
||||
void MirrorSpinStyle( bool aLeftRight ) override;
|
||||
|
|
|
@ -409,16 +409,16 @@ void SCH_LINE::MirrorHorizontally( int aCenter )
|
|||
}
|
||||
|
||||
|
||||
void SCH_LINE::Rotate( const VECTOR2I& 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, ANGLE_90 );
|
||||
RotatePoint( m_start, aCenter, aRotateCCW ? ANGLE_270 : ANGLE_90 );
|
||||
|
||||
else if( m_flags & ENDPOINT )
|
||||
RotatePoint( m_end, aCenter, ANGLE_90 );
|
||||
RotatePoint( m_end, aCenter, aRotateCCW ? ANGLE_270 : ANGLE_90 );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -212,7 +212,7 @@ public:
|
|||
|
||||
void MirrorVertically( int aCenter ) override;
|
||||
void MirrorHorizontally( int aCenter ) override;
|
||||
void Rotate( const VECTOR2I& aCenter ) override;
|
||||
void Rotate( const VECTOR2I& aCenter, bool aRotateCCW ) override;
|
||||
void RotateStart( const VECTOR2I& aCenter );
|
||||
void RotateEnd( const VECTOR2I& aCenter );
|
||||
|
||||
|
|
|
@ -328,7 +328,7 @@ BITMAPS SCH_MARKER::GetMenuImage() const
|
|||
}
|
||||
|
||||
|
||||
void SCH_MARKER::Rotate( const VECTOR2I& aCenter )
|
||||
void SCH_MARKER::Rotate( const VECTOR2I& aCenter, bool aRotateCCW )
|
||||
{
|
||||
// Marker geometry isn't user-editable
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ public:
|
|||
|
||||
void MirrorHorizontally( int aCenter ) override;
|
||||
void MirrorVertically( int aCenter ) override;
|
||||
void Rotate( const VECTOR2I& aCenter ) override;
|
||||
void Rotate( const VECTOR2I& aCenter, bool aRotateCCW ) override;
|
||||
|
||||
/**
|
||||
* Compare DRC marker main and auxiliary text against search string.
|
||||
|
|
|
@ -128,9 +128,9 @@ void SCH_NO_CONNECT::MirrorHorizontally( int aCenter )
|
|||
}
|
||||
|
||||
|
||||
void SCH_NO_CONNECT::Rotate( const VECTOR2I& aCenter )
|
||||
void SCH_NO_CONNECT::Rotate( const VECTOR2I& aCenter, bool aRotateCCW )
|
||||
{
|
||||
RotatePoint( m_pos, aCenter, ANGLE_90 );
|
||||
RotatePoint( m_pos, aCenter, aRotateCCW ? ANGLE_270 : ANGLE_90 );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ public:
|
|||
|
||||
void MirrorHorizontally( int aCenter ) override;
|
||||
void MirrorVertically( int aCenter ) override;
|
||||
void Rotate( const VECTOR2I& aCenter ) override;
|
||||
void Rotate( const VECTOR2I& aCenter, bool aRotateCCW ) override;
|
||||
|
||||
bool IsConnectable() const override { return true; }
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ public:
|
|||
|
||||
void MirrorHorizontally( int aCenter ) override {}
|
||||
void MirrorVertically( int aCenter ) override {}
|
||||
void Rotate( const VECTOR2I& aCenter ) override {}
|
||||
void Rotate( const VECTOR2I& aCenter, bool aRotateCCW ) override {}
|
||||
|
||||
VECTOR2I GetPosition() const override { return GetTransformedPosition(); }
|
||||
const VECTOR2I GetLocalPosition() const { return m_position; }
|
||||
|
|
|
@ -105,9 +105,9 @@ void SCH_SHAPE::MirrorVertically( int aCenter )
|
|||
}
|
||||
|
||||
|
||||
void SCH_SHAPE::Rotate( const VECTOR2I& aCenter )
|
||||
void SCH_SHAPE::Rotate( const VECTOR2I& aCenter, bool aRotateCCW )
|
||||
{
|
||||
rotate( aCenter, ANGLE_90 );
|
||||
rotate( aCenter, aRotateCCW ? ANGLE_270 : ANGLE_90 );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ public:
|
|||
|
||||
void MirrorHorizontally( int aCenter ) override;
|
||||
void MirrorVertically( int aCenter ) override;
|
||||
void Rotate( const VECTOR2I& aCenter ) override;
|
||||
void Rotate( const VECTOR2I& aCenter, bool aRotateCCW ) override;
|
||||
|
||||
void AddPoint( const VECTOR2I& aPosition );
|
||||
|
||||
|
|
|
@ -842,12 +842,12 @@ void SCH_SHEET::Move( const VECTOR2I& aMoveVector )
|
|||
}
|
||||
|
||||
|
||||
void SCH_SHEET::Rotate( const VECTOR2I& aCenter )
|
||||
void SCH_SHEET::Rotate( const VECTOR2I& aCenter, bool aRotateCCW )
|
||||
{
|
||||
VECTOR2I prev = m_pos;
|
||||
|
||||
RotatePoint( m_pos, aCenter, ANGLE_90 );
|
||||
RotatePoint( &m_size.x, &m_size.y, ANGLE_90 );
|
||||
RotatePoint( m_pos, aCenter, aRotateCCW ? ANGLE_270 : ANGLE_90 );
|
||||
RotatePoint( &m_size.x, &m_size.y, aRotateCCW ? ANGLE_270 : ANGLE_90 );
|
||||
|
||||
if( m_size.x < 0 )
|
||||
{
|
||||
|
@ -864,7 +864,7 @@ void SCH_SHEET::Rotate( const VECTOR2I& aCenter )
|
|||
// Pins must be rotated first as that's how we determine vertical vs horizontal
|
||||
// orientation for auto-placement
|
||||
for( SCH_SHEET_PIN* sheetPin : m_pins )
|
||||
sheetPin->Rotate( aCenter );
|
||||
sheetPin->Rotate( aCenter, aRotateCCW );
|
||||
|
||||
if( m_fieldsAutoplaced == FIELDS_AUTOPLACED_AUTO )
|
||||
{
|
||||
|
|
|
@ -324,7 +324,7 @@ public:
|
|||
void Move( const VECTOR2I& aMoveVector ) override;
|
||||
void MirrorHorizontally( int aCenter ) override;
|
||||
void MirrorVertically( int aCenter ) override;
|
||||
void Rotate( const VECTOR2I& aCenter ) override;
|
||||
void Rotate( const VECTOR2I& aCenter, bool aRotateCCW ) override;
|
||||
|
||||
bool Matches( const EDA_SEARCH_DATA& aSearchData, void* aAuxData ) const override;
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ public:
|
|||
void Move( const VECTOR2I& aMoveVector ) override {}
|
||||
void MirrorHorizontally( int aCenter ) override {}
|
||||
void MirrorVertically( int aCenter ) override {}
|
||||
void Rotate( const VECTOR2I& aCenter ) override {}
|
||||
void Rotate( const VECTOR2I& aCenter, bool aRotateCCW ) override {}
|
||||
|
||||
double Similarity( const SCH_ITEM& aOther ) const override
|
||||
{
|
||||
|
|
|
@ -252,12 +252,12 @@ void SCH_SHEET_PIN::MirrorHorizontally( int aCenter )
|
|||
}
|
||||
|
||||
|
||||
void SCH_SHEET_PIN::Rotate( const VECTOR2I& aCenter )
|
||||
void SCH_SHEET_PIN::Rotate( const VECTOR2I& aCenter, bool aRotateCCW )
|
||||
{
|
||||
VECTOR2I pt = GetTextPos();
|
||||
VECTOR2I delta = pt - aCenter;
|
||||
|
||||
RotatePoint( pt, aCenter, ANGLE_90 );
|
||||
RotatePoint( pt, aCenter, aRotateCCW ? ANGLE_270 : ANGLE_90 );
|
||||
|
||||
SHEET_SIDE oldSide = GetSide();
|
||||
ConstrainOnEdge( pt, true );
|
||||
|
|
|
@ -165,7 +165,7 @@ public:
|
|||
|
||||
void MirrorVertically( int aCenter ) override;
|
||||
void MirrorHorizontally( int aCenter ) override;
|
||||
void Rotate( const VECTOR2I& aCenter ) override;
|
||||
void Rotate( const VECTOR2I& aCenter, bool aRotateCCW ) override;
|
||||
|
||||
bool Matches( const EDA_SEARCH_DATA& aSearchData, void* aAuxData ) const override
|
||||
{
|
||||
|
|
|
@ -2036,13 +2036,13 @@ void SCH_SYMBOL::MirrorVertically( int aCenter )
|
|||
}
|
||||
|
||||
|
||||
void SCH_SYMBOL::Rotate( const VECTOR2I& aCenter )
|
||||
void SCH_SYMBOL::Rotate( const VECTOR2I& aCenter, bool aRotateCCW )
|
||||
{
|
||||
VECTOR2I prev = m_pos;
|
||||
|
||||
RotatePoint( m_pos, aCenter, ANGLE_90 );
|
||||
RotatePoint( m_pos, aCenter, aRotateCCW ? ANGLE_270 : ANGLE_90 );
|
||||
|
||||
SetOrientation( SYM_ROTATE_COUNTERCLOCKWISE );
|
||||
SetOrientation( aRotateCCW ? SYM_ROTATE_CLOCKWISE : SYM_ROTATE_COUNTERCLOCKWISE );
|
||||
|
||||
for( SCH_FIELD& field : m_fields )
|
||||
{
|
||||
|
|
|
@ -721,7 +721,7 @@ public:
|
|||
|
||||
void MirrorHorizontally( int aCenter ) override;
|
||||
void MirrorVertically( int aCenter ) override;
|
||||
void Rotate( const VECTOR2I& aCenter ) override;
|
||||
void Rotate( const VECTOR2I& aCenter, bool aRotateCCW ) override;
|
||||
|
||||
bool Matches( const EDA_SEARCH_DATA& aSearchData, void* aAuxData ) const override;
|
||||
|
||||
|
|
|
@ -200,10 +200,10 @@ void SCH_TABLE::MirrorVertically( int aCenter )
|
|||
}
|
||||
|
||||
|
||||
void SCH_TABLE::Rotate( const VECTOR2I& aCenter )
|
||||
void SCH_TABLE::Rotate( const VECTOR2I& aCenter, bool aRotateCCW )
|
||||
{
|
||||
for( SCH_TABLECELL* cell : m_cells )
|
||||
cell->Rotate( aCenter );
|
||||
cell->Rotate( aCenter, aRotateCCW );
|
||||
|
||||
Normalize();
|
||||
}
|
||||
|
|
|
@ -180,7 +180,7 @@ public:
|
|||
|
||||
void MirrorHorizontally( int aCenter ) override;
|
||||
void MirrorVertically( int aCenter ) override;
|
||||
void Rotate( const VECTOR2I& aCenter ) override;
|
||||
void Rotate( const VECTOR2I& aCenter, bool aRotateCCW ) override;
|
||||
|
||||
const BOX2I GetBoundingBox() const override;
|
||||
|
||||
|
|
|
@ -92,10 +92,10 @@ void SCH_TEXT::MirrorVertically( int aCenter )
|
|||
}
|
||||
|
||||
|
||||
void SCH_TEXT::Rotate( const VECTOR2I& aCenter )
|
||||
void SCH_TEXT::Rotate( const VECTOR2I& aCenter, bool aRotateCCW )
|
||||
{
|
||||
VECTOR2I pt = GetTextPos();
|
||||
RotatePoint( pt, aCenter, ANGLE_90 );
|
||||
RotatePoint( pt, aCenter, aRotateCCW ? ANGLE_270 : ANGLE_90 );
|
||||
VECTOR2I offset = pt - GetTextPos();
|
||||
|
||||
Rotate90( false );
|
||||
|
|
|
@ -108,7 +108,7 @@ public:
|
|||
|
||||
void MirrorHorizontally( int aCenter ) override;
|
||||
void MirrorVertically( int aCenter ) override;
|
||||
void Rotate( const VECTOR2I& aCenter ) override;
|
||||
void Rotate( const VECTOR2I& aCenter, bool aRotateCCW ) override;
|
||||
|
||||
virtual void Rotate90( bool aClockwise );
|
||||
virtual void MirrorSpinStyle( bool aLeftRight );
|
||||
|
|
|
@ -105,9 +105,9 @@ void SCH_TEXTBOX::MirrorVertically( int aCenter )
|
|||
}
|
||||
|
||||
|
||||
void SCH_TEXTBOX::Rotate( const VECTOR2I& aCenter )
|
||||
void SCH_TEXTBOX::Rotate( const VECTOR2I& aCenter, bool aRotateCCW )
|
||||
{
|
||||
SCH_SHAPE::Rotate( aCenter );
|
||||
SCH_SHAPE::Rotate( aCenter, aRotateCCW );
|
||||
SetTextAngle( GetTextAngle() == ANGLE_VERTICAL ? ANGLE_HORIZONTAL : ANGLE_VERTICAL );
|
||||
}
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ public:
|
|||
|
||||
void MirrorHorizontally( int aCenter ) override;
|
||||
void MirrorVertically( int aCenter ) override;
|
||||
void Rotate( const VECTOR2I& aCenter ) override;
|
||||
void Rotate( const VECTOR2I& aCenter, bool aRotateCCW ) override;
|
||||
|
||||
virtual void Rotate90( bool aClockwise );
|
||||
|
||||
|
|
|
@ -1112,11 +1112,13 @@ int SCH_DRAWING_TOOLS::SingleClickPlace( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
SCH_BUS_ENTRY_BASE* busItem = static_cast<SCH_BUS_ENTRY_BASE*>( previewItem );
|
||||
|
||||
// The bus entries only rotate in one direction
|
||||
if( evt->IsAction( &EE_ACTIONS::rotateCW )
|
||||
|| evt->IsAction( &EE_ACTIONS::rotateCCW ) )
|
||||
if( evt->IsAction( &EE_ACTIONS::rotateCW ) )
|
||||
{
|
||||
busItem->Rotate( busItem->GetPosition() );
|
||||
busItem->Rotate( busItem->GetPosition(), false );
|
||||
}
|
||||
else if( evt->IsAction( &EE_ACTIONS::rotateCCW ) )
|
||||
{
|
||||
busItem->Rotate( busItem->GetPosition(), true );
|
||||
}
|
||||
else if( evt->IsAction( &EE_ACTIONS::mirrorV ) )
|
||||
{
|
||||
|
|
|
@ -692,8 +692,7 @@ int SCH_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( head );
|
||||
|
||||
for( int i = 0; clockwise ? i < 3 : i < 1; ++i )
|
||||
symbol->Rotate( rotPoint );
|
||||
symbol->Rotate( rotPoint, !clockwise );
|
||||
|
||||
if( m_frame->eeconfig()->m_AutoplaceFields.enable )
|
||||
symbol->AutoAutoplaceFields( m_frame->GetScreen() );
|
||||
|
@ -718,8 +717,7 @@ int SCH_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
|
|||
SCH_SHEET_PIN* pin = static_cast<SCH_SHEET_PIN*>( head );
|
||||
SCH_SHEET* sheet = pin->GetParent();
|
||||
|
||||
for( int i = 0; clockwise ? i < 3 : i < 1; ++i )
|
||||
pin->Rotate( sheet->GetBodyBoundingBox().GetCenter() );
|
||||
pin->Rotate( sheet->GetBoundingBox().GetCenter(), !clockwise );
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -752,8 +750,7 @@ int SCH_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
|
|||
case SCH_NO_CONNECT_T:
|
||||
case SCH_BUS_BUS_ENTRY_T:
|
||||
case SCH_BUS_WIRE_ENTRY_T:
|
||||
for( int i = 0; clockwise ? i < 3 : i < 1; ++i )
|
||||
head->Rotate( rotPoint );
|
||||
head->Rotate( rotPoint, !clockwise );
|
||||
|
||||
break;
|
||||
|
||||
|
@ -774,8 +771,7 @@ int SCH_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
|
|||
|
||||
case SCH_SHAPE_T:
|
||||
case SCH_TEXTBOX_T:
|
||||
for( int i = 0; clockwise ? i < 3 : i < 1; ++i )
|
||||
head->Rotate( rotPoint );
|
||||
head->Rotate( rotPoint, !clockwise );
|
||||
|
||||
break;
|
||||
|
||||
|
@ -786,15 +782,13 @@ int SCH_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
|
|||
BOX2I box( table->GetPosition(), table->GetEnd() - table->GetPosition() );
|
||||
rotPoint = m_frame->GetNearestHalfGridPosition( box.GetCenter() );
|
||||
|
||||
for( int i = 0; clockwise ? i < 3 : i < 1; ++i )
|
||||
head->Rotate( rotPoint );
|
||||
head->Rotate( rotPoint, !clockwise );
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case SCH_BITMAP_T:
|
||||
for( int i = 0; clockwise ? i < 3 : i < 1; ++i )
|
||||
head->Rotate( rotPoint );
|
||||
head->Rotate( rotPoint, !clockwise );
|
||||
|
||||
// The bitmap is cached in Opengl: clear the cache to redraw
|
||||
getView()->RecacheAllItems();
|
||||
|
@ -804,10 +798,9 @@ int SCH_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
// Rotate the sheet on itself. Sheets do not have an anchor point.
|
||||
SCH_SHEET* sheet = static_cast<SCH_SHEET*>( head );
|
||||
rotPoint = m_frame->GetNearestHalfGridPosition( sheet->GetRotationCenter() );
|
||||
|
||||
for( int i = 0; clockwise ? i < 3 : i < 1; ++i )
|
||||
sheet->Rotate( rotPoint );
|
||||
rotPoint = m_frame->GetNearestHalfGridPosition( sheet->GetRotationCenter() );
|
||||
sheet->Rotate( rotPoint, !clockwise );
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -864,7 +857,7 @@ int SCH_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
|
|||
SCH_SHEET_PIN* pin = static_cast<SCH_SHEET_PIN*>( item );
|
||||
SCH_SHEET* sheet = pin->GetParent();
|
||||
|
||||
pin->Rotate( sheet->GetBodyBoundingBox().GetCenter() );
|
||||
pin->Rotate( sheet->GetBodyBoundingBox().GetCenter(), false );
|
||||
}
|
||||
}
|
||||
else if( item->Type() == SCH_FIELD_T )
|
||||
|
@ -877,7 +870,7 @@ int SCH_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
SCH_FIELD* field = static_cast<SCH_FIELD*>( item );
|
||||
|
||||
field->Rotate( rotPoint );
|
||||
field->Rotate( rotPoint, false );
|
||||
|
||||
if( field->GetTextAngle().IsHorizontal() )
|
||||
field->SetTextAngle( ANGLE_VERTICAL );
|
||||
|
@ -890,7 +883,7 @@ int SCH_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
else
|
||||
{
|
||||
item->Rotate( rotPoint );
|
||||
item->Rotate( rotPoint, false );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -230,18 +230,18 @@ BOOST_AUTO_TEST_CASE( Rotate )
|
|||
{
|
||||
schItem->ClearFieldsAutoplaced();
|
||||
// Only rotating pins around the center of parent sheet works.
|
||||
schItem->Rotate( m_sheet.GetBodyBoundingBox().GetCenter() );
|
||||
schItem->Rotate( m_sheet.GetBodyBoundingBox().GetCenter() );
|
||||
schItem->Rotate( m_sheet.GetBodyBoundingBox().GetCenter() );
|
||||
schItem->Rotate( m_sheet.GetBodyBoundingBox().GetCenter() );
|
||||
schItem->Rotate( m_sheet.GetBodyBoundingBox().GetCenter(), false );
|
||||
schItem->Rotate( m_sheet.GetBodyBoundingBox().GetCenter(), false );
|
||||
schItem->Rotate( m_sheet.GetBodyBoundingBox().GetCenter(), false );
|
||||
schItem->Rotate( m_sheet.GetBodyBoundingBox().GetCenter(), false );
|
||||
}
|
||||
|
||||
if( libItem != nullptr )
|
||||
{
|
||||
libItem->Rotate( m_sheet.GetBodyBoundingBox().GetCenter() );
|
||||
libItem->Rotate( m_sheet.GetBodyBoundingBox().GetCenter() );
|
||||
libItem->Rotate( m_sheet.GetBodyBoundingBox().GetCenter() );
|
||||
libItem->Rotate( m_sheet.GetBodyBoundingBox().GetCenter() );
|
||||
libItem->Rotate( m_sheet.GetBodyBoundingBox().GetCenter(), false );
|
||||
libItem->Rotate( m_sheet.GetBodyBoundingBox().GetCenter(), false );
|
||||
libItem->Rotate( m_sheet.GetBodyBoundingBox().GetCenter(), false );
|
||||
libItem->Rotate( m_sheet.GetBodyBoundingBox().GetCenter(), false );
|
||||
}
|
||||
|
||||
CompareItems( newItem.get(), item.get() );
|
||||
|
@ -260,18 +260,18 @@ BOOST_AUTO_TEST_CASE( Rotate )
|
|||
if( schItem != nullptr )
|
||||
{
|
||||
schItem->ClearFieldsAutoplaced();
|
||||
schItem->Rotate( aRef );
|
||||
schItem->Rotate( aRef );
|
||||
schItem->Rotate( aRef );
|
||||
schItem->Rotate( aRef );
|
||||
schItem->Rotate( aRef, false );
|
||||
schItem->Rotate( aRef, false );
|
||||
schItem->Rotate( aRef, false );
|
||||
schItem->Rotate( aRef, false );
|
||||
}
|
||||
|
||||
if( libItem != nullptr )
|
||||
{
|
||||
libItem->Rotate( aRef );
|
||||
libItem->Rotate( aRef );
|
||||
libItem->Rotate( aRef );
|
||||
libItem->Rotate( aRef );
|
||||
libItem->Rotate( aRef, false );
|
||||
libItem->Rotate( aRef, false );
|
||||
libItem->Rotate( aRef, false );
|
||||
libItem->Rotate( aRef, false );
|
||||
}
|
||||
|
||||
CompareItems( item.get(), aOriginalItem );
|
||||
|
|
Loading…
Reference in New Issue