PNS: Use segment shape for all oval pads

Instead of calculating a simple polygon for the oval pads that are
rotated, we use a rotated segment.

Fixes https://gitlab.com/kicad/code/kicad/issues/4604
This commit is contained in:
Seth Hillbrand 2020-06-04 20:28:04 -07:00
parent 5b47d1a910
commit 25b8da8e3b
1 changed files with 4 additions and 36 deletions

View File

@ -650,44 +650,12 @@ std::unique_ptr<PNS::SOLID> PNS_KICAD_IFACE::syncPad( D_PAD* aPad )
{
wxPoint start;
wxPoint end;
wxPoint corner;
SHAPE_SIMPLE* shape = new SHAPE_SIMPLE();
int w = aPad->BuildSegmentFromOvalShape( start, end, 0.0, wxSize( 0, 0 ) );
if( start.y == 0 )
corner = wxPoint( start.x, -( w / 2 ) );
else
corner = wxPoint( w / 2, start.y );
RotatePoint( &start, aPad->GetOrientation() );
RotatePoint( &corner, aPad->GetOrientation() );
shape->Append( wx_c + corner );
for( int rot = 100; rot <= 1800; rot += 100 )
{
wxPoint p( corner );
RotatePoint( &p, start, rot );
shape->Append( wx_c + p );
}
if( end.y == 0 )
corner = wxPoint( end.x, w / 2 );
else
corner = wxPoint( -( w / 2 ), end.y );
RotatePoint( &end, aPad->GetOrientation() );
RotatePoint( &corner, aPad->GetOrientation() );
shape->Append( wx_c + corner );
for( int rot = 100; rot <= 1800; rot += 100 )
{
wxPoint p( corner );
RotatePoint( &p, end, rot );
shape->Append( wx_c + p );
}
int w = aPad->BuildSegmentFromOvalShape( start, end, aPad->GetOrientation(),
wxSize( 0, 0 ) );
SHAPE_SEGMENT* shape = new SHAPE_SEGMENT( start, end, w );
shape->Move( aPad->ShapePos() );
solid->SetShape( shape );
}
break;