Improvements to rotation/mirroring of dimensions inside footprints.

Fixes https://gitlab.com/kicad/code/kicad/issues/11861
This commit is contained in:
Jeff Young 2022-06-20 21:15:21 +01:00
parent 23e8bafd9c
commit aad85a83da
3 changed files with 19 additions and 11 deletions

View File

@ -1622,19 +1622,11 @@ void FOOTPRINT::Flip( const VECTOR2I& aCentre, bool aFlipLeftRight )
break;
case PCB_FP_DIM_ALIGNED_T:
static_cast<PCB_DIM_ALIGNED*>( item )->Flip( m_pos, false );
break;
case PCB_FP_DIM_ORTHOGONAL_T:
static_cast<PCB_DIM_ORTHOGONAL*>( item )->Flip( m_pos, false );
break;
case PCB_FP_DIM_RADIAL_T:
static_cast<PCB_DIM_RADIAL*>( item )->Flip( m_pos, false );
break;
case PCB_FP_DIM_CENTER_T:
case PCB_FP_DIM_LEADER_T:
static_cast<PCB_DIM_LEADER*>( item )->Flip( m_pos, false );
static_cast<PCB_DIMENSION_BASE*>( item )->Flip( m_pos, false );
break;
default:
@ -1803,6 +1795,12 @@ void FOOTPRINT::SetOrientation( const EDA_ANGLE& aNewAngle )
for( ZONE* zone : m_fp_zones )
zone->Rotate( GetPosition(), angleChange );
for( BOARD_ITEM* item : m_drawings )
{
if( PCB_DIMENSION_BASE* dimension = dynamic_cast<PCB_DIMENSION_BASE*>( item ) )
dimension->Rotate( GetPosition(), angleChange );
}
// Update of the reference and value.
m_reference->SetDrawCoord();
m_value->SetDrawCoord();

View File

@ -583,6 +583,14 @@ void PCB_DIM_ALIGNED::SwapData( BOARD_ITEM* aImage )
}
void PCB_DIM_ALIGNED::Mirror( const VECTOR2I& axis_pos, bool aMirrorLeftRight )
{
PCB_DIMENSION_BASE::Mirror( axis_pos, aMirrorLeftRight );
m_height = -m_height;
}
BITMAPS PCB_DIM_ALIGNED::GetMenuImage() const
{
return BITMAPS::add_aligned_dimension;

View File

@ -233,7 +233,7 @@ public:
*
* @param axis_pos is the vertical axis position to mirror around.
*/
void Mirror( const VECTOR2I& axis_pos, bool aMirrorLeftRight = false );
virtual void Mirror( const VECTOR2I& axis_pos, bool aMirrorLeftRight = false );
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
@ -360,6 +360,8 @@ public:
virtual void SwapData( BOARD_ITEM* aImage ) override;
void Mirror( const VECTOR2I& axis_pos, bool aMirrorLeftRight = false ) override;
BITMAPS GetMenuImage() const override;
const VECTOR2I& GetCrossbarStart() const { return m_crossBarStart; }