Support for trapezoidal pads.

This commit is contained in:
Maciej Suminski 2013-09-03 13:51:53 +02:00
parent f4ec1e729e
commit 8a0157069b
1 changed files with 31 additions and 1 deletions

View File

@ -570,10 +570,40 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
break; break;
case PAD_RECT: case PAD_RECT:
case PAD_TRAPEZOID:
m_gal->DrawRectangle( VECTOR2D( -size.x, -size.y ), VECTOR2D( size.x, size.y ) ); m_gal->DrawRectangle( VECTOR2D( -size.x, -size.y ), VECTOR2D( size.x, size.y ) );
break; break;
case PAD_TRAPEZOID:
{
std::deque<VECTOR2D> pointList;
wxPoint corners[4];
VECTOR2D padSize = VECTOR2D( aPad->GetSize().x, aPad->GetSize().y ) / 2;
VECTOR2D deltaPadSize = size - padSize; // = solder[Paste/Mask]Margin or 0
VECTOR2D delta = VECTOR2D( aPad->GetDelta().x / 2,
aPad->GetDelta().y / 2 );
VECTOR2D inflate = VECTOR2D( delta.y * ( deltaPadSize.x / size.x ),
delta.x * ( deltaPadSize.y / size.y ) );
aPad->BuildPadPolygon( corners, wxSize( deltaPadSize.x, deltaPadSize.y ), 0.0 );
pointList.push_back( VECTOR2D( corners[0] ) );
pointList.push_back( VECTOR2D( corners[1] ) );
pointList.push_back( VECTOR2D( corners[2] ) );
pointList.push_back( VECTOR2D( corners[3] ) );
if( m_pcbSettings->m_sketchModeSelect[PADS_VISIBLE] )
{
// Add the beginning point to close the outline
pointList.push_back( pointList.front() );
m_gal->DrawPolyline( pointList );
}
else
{
m_gal->DrawPolygon( pointList );
}
}
break;
case PAD_CIRCLE: case PAD_CIRCLE:
m_gal->DrawCircle( VECTOR2D( 0.0, 0.0 ), size.x ); m_gal->DrawCircle( VECTOR2D( 0.0, 0.0 ), size.x );
break; break;