Normalize rects higher up.
We don't want to normalize footprint children to their board-relative coordinates.
This commit is contained in:
parent
acda18465c
commit
fc0017fc95
|
@ -351,14 +351,6 @@ void EDA_SHAPE::rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle )
|
|||
{
|
||||
RotatePoint( m_start, aRotCentre, aAngle );
|
||||
RotatePoint( m_end, aRotCentre, aAngle );
|
||||
|
||||
// Normalize
|
||||
BOX2I bbox;
|
||||
bbox.Merge( m_start );
|
||||
bbox.Merge( m_end );
|
||||
m_start = bbox.GetOrigin();
|
||||
m_end = bbox.GetEnd();
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -413,17 +405,6 @@ void EDA_SHAPE::flip( const VECTOR2I& aCentre, bool aFlipLeftRight )
|
|||
}
|
||||
|
||||
std::swap( m_start, m_end );
|
||||
|
||||
if( m_shape == SHAPE_T::RECTANGLE )
|
||||
{
|
||||
// Normalize
|
||||
BOX2I bbox;
|
||||
bbox.Merge( m_start );
|
||||
bbox.Merge( m_end );
|
||||
m_start = bbox.GetOrigin();
|
||||
m_end = bbox.GetEnd();
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case SHAPE_T::CIRCLE:
|
||||
|
|
|
@ -327,6 +327,11 @@ public:
|
|||
*/
|
||||
virtual void Flip( const VECTOR2I& aCentre, bool aFlipLeftRight );
|
||||
|
||||
/**
|
||||
* Perform any normalization required after a user rotate and/or flip.
|
||||
*/
|
||||
virtual void Normalize() {}
|
||||
|
||||
/**
|
||||
* Return the #BOARD in which this #BOARD_ITEM resides, or NULL if none.
|
||||
*/
|
||||
|
|
|
@ -530,10 +530,7 @@ bool FOOTPRINT::FootprintNeedsUpdate( const FOOTPRINT* aLibFP, REPORTER* aReport
|
|||
temp->SetOrientation( ANGLE_0 );
|
||||
|
||||
for( BOARD_ITEM* item : temp->GraphicalItems() )
|
||||
{
|
||||
if( item->Type() == PCB_SHAPE_T )
|
||||
static_cast<PCB_SHAPE*>( item )->NormalizeRect();
|
||||
}
|
||||
item->Normalize();
|
||||
|
||||
diff = temp->FootprintNeedsUpdate( aLibFP, aReporter );
|
||||
|
||||
|
|
|
@ -244,7 +244,7 @@ void PCB_SHAPE::Scale( double aScale )
|
|||
}
|
||||
|
||||
|
||||
void PCB_SHAPE::NormalizeRect()
|
||||
void PCB_SHAPE::Normalize()
|
||||
{
|
||||
if( m_shape == SHAPE_T::RECTANGLE )
|
||||
{
|
||||
|
|
|
@ -121,13 +121,13 @@ public:
|
|||
return hitTest( aRect, aContained, aAccuracy );
|
||||
}
|
||||
|
||||
void NormalizeRect();
|
||||
void Normalize() override;
|
||||
|
||||
virtual void Move( const VECTOR2I& aMoveVector ) override;
|
||||
void Move( const VECTOR2I& aMoveVector ) override;
|
||||
|
||||
virtual void Rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle ) override;
|
||||
void Rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle ) override;
|
||||
|
||||
virtual void Flip( const VECTOR2I& aCentre, bool aFlipLeftRight ) override;
|
||||
void Flip( const VECTOR2I& aCentre, bool aFlipLeftRight ) override;
|
||||
|
||||
virtual void Mirror( const VECTOR2I& aCentre, bool aMirrorAroundXAxis );
|
||||
|
||||
|
|
|
@ -2745,13 +2745,12 @@ PCB_SHAPE* PCB_PARSER::parsePCB_SHAPE( BOARD_ITEM* aParent )
|
|||
|
||||
if( aParent && aParent->Type() == PCB_FOOTPRINT_T )
|
||||
{
|
||||
// I'm not aware of any reason to skip normalization of footprint rects, except
|
||||
// that that's what we've always done. (And, FWIW, the Alitum test gold files
|
||||
// currently depend on this behaviour.)
|
||||
// Footprint shapes are stored in board-relative coordinates, but we want the
|
||||
// normalization to remain in footprint-relative coordinates.
|
||||
}
|
||||
else
|
||||
{
|
||||
shape->NormalizeRect();
|
||||
shape->Normalize();
|
||||
}
|
||||
|
||||
NeedRIGHT();
|
||||
|
|
|
@ -423,7 +423,7 @@ int DRAWING_TOOL::DrawRectangle( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
else
|
||||
{
|
||||
rect->NormalizeRect();
|
||||
rect->Normalize();
|
||||
commit.Add( rect );
|
||||
commit.Push( isTextBox ? _( "Draw Text Box" ) : _( "Draw Rectangle" ) );
|
||||
|
||||
|
|
|
@ -1767,7 +1767,10 @@ int EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
|
||||
if( BOARD_ITEM* board_item = dynamic_cast<BOARD_ITEM*>( item ) )
|
||||
{
|
||||
board_item->Rotate( refPt, rotateAngle );
|
||||
board_item->Normalize();
|
||||
}
|
||||
}
|
||||
|
||||
if( !localCommit.Empty() )
|
||||
|
@ -2054,6 +2057,7 @@ int EDIT_TOOL::Flip( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
|
||||
boardItem->Flip( refPt, leftRight );
|
||||
boardItem->Normalize();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue