Code formatting fixes
This commit is contained in:
parent
cd738297b0
commit
b71fc5564a
|
@ -373,19 +373,12 @@ bool EDA_RECT::Contains( const wxPoint& aPoint ) const
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* return true if aRect is inside me (or on boundaries)
|
||||
*/
|
||||
bool EDA_RECT::Contains( const EDA_RECT& aRect ) const
|
||||
{
|
||||
return Contains( aRect.GetOrigin() ) && Contains( aRect.GetEnd() );
|
||||
}
|
||||
|
||||
|
||||
/* Intersects
|
||||
* test for a common area between segment and rect.
|
||||
* return true if at least a common point is found
|
||||
*/
|
||||
bool EDA_RECT::Intersects( const wxPoint& aPoint1, const wxPoint& aPoint2 ) const
|
||||
{
|
||||
wxPoint point2, point4;
|
||||
|
@ -412,10 +405,6 @@ bool EDA_RECT::Intersects( const wxPoint& aPoint1, const wxPoint& aPoint2 ) cons
|
|||
}
|
||||
|
||||
|
||||
/* Intersects
|
||||
* test for a common area between 2 rect.
|
||||
* return true if at least a common point is found
|
||||
*/
|
||||
bool EDA_RECT::Intersects( const EDA_RECT& aRect ) const
|
||||
{
|
||||
// this logic taken from wxWidgets' geometry.cpp file:
|
||||
|
@ -443,6 +432,7 @@ bool EDA_RECT::Intersects( const EDA_RECT& aRect ) const
|
|||
return rc;
|
||||
}
|
||||
|
||||
|
||||
bool EDA_RECT::Intersects( const EDA_RECT& aRect, double aRot ) const
|
||||
{
|
||||
/* Most rectangles will be axis aligned.
|
||||
|
@ -459,7 +449,7 @@ bool EDA_RECT::Intersects( const EDA_RECT& aRect, double aRot ) const
|
|||
NORMALIZE_ANGLE_POS<double>( aRot );
|
||||
|
||||
// Test for non-rotated rectangle
|
||||
for( int ii=0; ii<5; ii++ )
|
||||
for( int ii = 0; ii < 5; ii++ )
|
||||
{
|
||||
if( std::fabs( aRot - ROT_PARALLEL[ii] ) < ROT_EPS )
|
||||
{
|
||||
|
@ -468,7 +458,7 @@ bool EDA_RECT::Intersects( const EDA_RECT& aRect, double aRot ) const
|
|||
}
|
||||
|
||||
// Test for rectangle rotated by multiple of 90 degrees
|
||||
for( int jj=0; jj<4; jj++ )
|
||||
for( int jj = 0; jj < 4; jj++ )
|
||||
{
|
||||
if( std::fabs( aRot - ROT_PERPENDICULAR[jj] ) < ROT_EPS )
|
||||
{
|
||||
|
@ -499,7 +489,7 @@ bool EDA_RECT::Intersects( const EDA_RECT& aRect, double aRot ) const
|
|||
|
||||
wxPoint rCentre = aRect.Centre();
|
||||
|
||||
for( int i=0; i<4; i++ )
|
||||
for( int i = 0; i < 4; i++ )
|
||||
{
|
||||
wxPoint delta = corners[i] - rCentre;
|
||||
RotatePoint( &delta, -aRot );
|
||||
|
@ -547,9 +537,10 @@ bool EDA_RECT::Intersects( const EDA_RECT& aRect, double aRot ) const
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
const wxPoint EDA_RECT::ClosestPointTo( const wxPoint& aPoint ) const
|
||||
{
|
||||
EDA_RECT me(*this);
|
||||
EDA_RECT me( *this );
|
||||
|
||||
me.Normalize(); // ensure size is >= 0
|
||||
|
||||
|
@ -560,9 +551,10 @@ const wxPoint EDA_RECT::ClosestPointTo( const wxPoint& aPoint ) const
|
|||
return wxPoint( nx, ny );
|
||||
}
|
||||
|
||||
|
||||
const wxPoint EDA_RECT::FarthestPointTo( const wxPoint& aPoint ) const
|
||||
{
|
||||
EDA_RECT me(*this);
|
||||
EDA_RECT me( *this );
|
||||
|
||||
me.Normalize(); // ensure size is >= 0
|
||||
|
||||
|
@ -572,9 +564,7 @@ const wxPoint EDA_RECT::FarthestPointTo( const wxPoint& aPoint ) const
|
|||
return wxPoint( fx, fy );
|
||||
}
|
||||
|
||||
/* IntersectsCircle
|
||||
* test for common area between this rect and a circle
|
||||
*/
|
||||
|
||||
bool EDA_RECT::IntersectsCircle( const wxPoint& aCenter, const int aRadius ) const
|
||||
{
|
||||
wxPoint closest = ClosestPointTo( aCenter );
|
||||
|
@ -587,9 +577,10 @@ bool EDA_RECT::IntersectsCircle( const wxPoint& aCenter, const int aRadius ) con
|
|||
return ( dx * dx + dy * dy ) <= ( r * r );
|
||||
}
|
||||
|
||||
|
||||
bool EDA_RECT::IntersectsCircleEdge( const wxPoint& aCenter, const int aRadius, const int aWidth ) const
|
||||
{
|
||||
EDA_RECT me(*this);
|
||||
EDA_RECT me( *this );
|
||||
me.Normalize(); // ensure size is >= 0
|
||||
|
||||
// Test if the circle intersects at all
|
||||
|
@ -608,6 +599,7 @@ bool EDA_RECT::IntersectsCircleEdge( const wxPoint& aCenter, const int aRadius,
|
|||
return ( fx * fx + fy * fy ) > ( r * r );
|
||||
}
|
||||
|
||||
|
||||
EDA_RECT& EDA_RECT::Inflate( int aDelta )
|
||||
{
|
||||
Inflate( aDelta, aDelta );
|
||||
|
@ -743,8 +735,6 @@ EDA_RECT EDA_RECT::Common( const EDA_RECT& aRect ) const
|
|||
}
|
||||
|
||||
|
||||
/* Calculate the bounding box of this, when rotated
|
||||
*/
|
||||
const EDA_RECT EDA_RECT::GetBoundingBoxRotated( wxPoint aRotCenter, double aAngle )
|
||||
{
|
||||
wxPoint corners[4];
|
||||
|
|
|
@ -45,6 +45,7 @@ SELECTION_AREA::SELECTION_AREA() :
|
|||
SetFillColor( SELECT_MODE_NORMAL );
|
||||
}
|
||||
|
||||
|
||||
void SELECTION_AREA::SetAdditive( bool aAdditive )
|
||||
{
|
||||
m_additive = aAdditive;
|
||||
|
@ -53,14 +54,16 @@ void SELECTION_AREA::SetAdditive( bool aAdditive )
|
|||
m_subtractive = false;
|
||||
}
|
||||
|
||||
|
||||
void SELECTION_AREA::SetSubtractive( bool aSubtractive )
|
||||
{
|
||||
m_subtractive = aSubtractive;
|
||||
|
||||
if ( m_subtractive )
|
||||
if( m_subtractive )
|
||||
m_additive = false;
|
||||
}
|
||||
|
||||
|
||||
const BOX2I SELECTION_AREA::ViewBBox() const
|
||||
{
|
||||
BOX2I tmp;
|
||||
|
@ -94,4 +97,3 @@ void SELECTION_AREA::drawPreviewShape( KIGFX::GAL& aGal ) const
|
|||
|
||||
aGal.DrawRectangle( m_origin, m_end );
|
||||
}
|
||||
|
||||
|
|
|
@ -196,7 +196,6 @@ public:
|
|||
*/
|
||||
bool IntersectsCircle( const wxPoint& aCenter, const int aRadius ) const;
|
||||
|
||||
|
||||
/**
|
||||
* IntersectsCircleEdge
|
||||
* Tests for intersection between this rect and the edge (radius) of a circle
|
||||
|
|
|
@ -178,9 +178,6 @@ int D_PAD::GetRoundRectCornerRadius( const wxSize& aSize ) const
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the BoundingBox for a D_PAD
|
||||
*/
|
||||
const EDA_RECT D_PAD::GetBoundingBox() const
|
||||
{
|
||||
EDA_RECT area;
|
||||
|
@ -751,6 +748,7 @@ void D_PAD::GetOblongDrillGeometry( wxPoint& aStartPoint,
|
|||
aEndPoint.y = - delta_cy;
|
||||
}
|
||||
|
||||
|
||||
bool D_PAD::HitTest( const wxPoint& aPosition ) const
|
||||
{
|
||||
int dx, dy;
|
||||
|
@ -831,9 +829,7 @@ bool D_PAD::HitTest( const wxPoint& aPosition ) const
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if an x,y axis-aligned rectangle hits this pad
|
||||
*/
|
||||
|
||||
bool D_PAD::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const
|
||||
{
|
||||
EDA_RECT arect = aRect;
|
||||
|
|
|
@ -89,6 +89,7 @@ void TEXTE_MODULE::SetTextAngle( double aAngle )
|
|||
EDA_TEXT::SetTextAngle( NormalizeAngle360( aAngle ) );
|
||||
}
|
||||
|
||||
|
||||
bool TEXTE_MODULE::TextHitTest( const wxPoint& aPoint, int aAccuracy ) const
|
||||
{
|
||||
EDA_RECT rect = GetTextBox( -1 );
|
||||
|
@ -101,6 +102,7 @@ bool TEXTE_MODULE::TextHitTest( const wxPoint& aPoint, int aAccuracy ) const
|
|||
return rect.Contains( location );
|
||||
}
|
||||
|
||||
|
||||
bool TEXTE_MODULE::TextHitTest( const EDA_RECT& aRect, bool aContains, int aAccuracy ) const
|
||||
{
|
||||
EDA_RECT rect = aRect;
|
||||
|
@ -115,7 +117,6 @@ bool TEXTE_MODULE::TextHitTest( const EDA_RECT& aRect, bool aContains, int aAccu
|
|||
{
|
||||
return rect.Intersects( GetTextBox( -1 ), GetDrawRotation() );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue