EDA_SHAPE: Remove m_upsideDownCoords hack (Fixes hitTest routine)

This commit is contained in:
Roberto Fernandez Bautista 2022-08-27 12:37:43 +01:00
parent 2812794742
commit 029cc65b34
5 changed files with 7 additions and 16 deletions

View File

@ -37,14 +37,13 @@
#include <plotters/plotter.h>
EDA_SHAPE::EDA_SHAPE( SHAPE_T aType, int aLineWidth, FILL_T aFill, bool upsideDownCoords ) :
EDA_SHAPE::EDA_SHAPE( SHAPE_T aType, int aLineWidth, FILL_T aFill ) :
m_endsSwapped( false ),
m_shape( aType ),
m_stroke( aLineWidth, PLOT_DASH_TYPE::DEFAULT, COLOR4D::UNSPECIFIED ),
m_fill( aFill ),
m_fillColor( COLOR4D::UNSPECIFIED ),
m_editState( 0 ),
m_upsideDownCoords( upsideDownCoords )
m_editState( 0 )
{
}
@ -747,9 +746,6 @@ bool EDA_SHAPE::hitTest( const VECTOR2I& aPosition, int aAccuracy ) const
EDA_ANGLE endAngle;
CalcArcAngles( startAngle, endAngle );
if( m_upsideDownCoords && ( startAngle - endAngle ).Normalize180() > ANGLE_0 )
std::swap( startAngle, endAngle );
EDA_ANGLE relPosAngle( relPos );
startAngle.Normalize();
@ -1035,9 +1031,6 @@ void EDA_SHAPE::computeArcBBox( EDA_RECT& aBBox ) const
CalcArcAngles( t1, t2 );
if( m_upsideDownCoords && ( t1 - t2 ).Normalize180() > ANGLE_0 )
std::swap( t1, t2 );
t1.Normalize();
t2.Normalize();
@ -1448,7 +1441,6 @@ void EDA_SHAPE::SwapShape( EDA_SHAPE* aImage )
SWAPITEM( m_poly );
SWAPITEM( m_fill );
SWAPITEM( m_fillColor );
SWAPITEM( m_upsideDownCoords );
SWAPITEM( m_editState );
SWAPITEM( m_endsSwapped );
#undef SWAPITEM

View File

@ -36,7 +36,7 @@
LIB_SHAPE::LIB_SHAPE( LIB_SYMBOL* aParent, SHAPE_T aShape, int aLineWidth, FILL_T aFillType,
KICAD_T aType ) :
LIB_ITEM( aType, aParent ),
EDA_SHAPE( aShape, aLineWidth, aFillType, true )
EDA_SHAPE( aShape, aLineWidth, aFillType )
{
m_editState = 0;
}

View File

@ -36,7 +36,7 @@
SCH_SHAPE::SCH_SHAPE( SHAPE_T aShape, int aLineWidth, FILL_T aFillType, KICAD_T aType ) :
SCH_ITEM( nullptr, aType ),
EDA_SHAPE( aShape, aLineWidth, aFillType, false )
EDA_SHAPE( aShape, aLineWidth, aFillType )
{
SetLayer( LAYER_NOTES );
}

View File

@ -73,7 +73,7 @@ struct ARC_MID
class EDA_SHAPE
{
public:
EDA_SHAPE( SHAPE_T aType, int aLineWidth, FILL_T aFill, bool eeWinding );
EDA_SHAPE( SHAPE_T aType, int aLineWidth, FILL_T aFill );
// Do not create a copy constructor & operator=.
// The ones generated by the compiler are adequate.
@ -377,7 +377,6 @@ protected:
SHAPE_POLY_SET m_poly; // Stores the S_POLYGON shape
int m_editState;
bool m_upsideDownCoords; // Awful hack
};
#endif // EDA_SHAPE_H

View File

@ -36,14 +36,14 @@
PCB_SHAPE::PCB_SHAPE( BOARD_ITEM* aParent, KICAD_T aItemType, SHAPE_T aShapeType ) :
BOARD_ITEM( aParent, aItemType ),
EDA_SHAPE( aShapeType, Millimeter2iu( DEFAULT_LINE_WIDTH ), FILL_T::NO_FILL, false )
EDA_SHAPE( aShapeType, Millimeter2iu( DEFAULT_LINE_WIDTH ), FILL_T::NO_FILL )
{
}
PCB_SHAPE::PCB_SHAPE( BOARD_ITEM* aParent, SHAPE_T shapetype ) :
BOARD_ITEM( aParent, PCB_SHAPE_T ),
EDA_SHAPE( shapetype, Millimeter2iu( DEFAULT_LINE_WIDTH ), FILL_T::NO_FILL, false )
EDA_SHAPE( shapetype, Millimeter2iu( DEFAULT_LINE_WIDTH ), FILL_T::NO_FILL )
{
}