Handle rotation for N/S/E/W pad cardinal points.

Fixes: lp:1844727
* https://bugs.launchpad.net/kicad/+bug/1844727
This commit is contained in:
Jeff Young 2019-10-31 19:36:54 +00:00
parent caf5d01530
commit a6a4973324
1 changed files with 27 additions and 12 deletions

View File

@ -63,6 +63,34 @@ const VECTOR2I CN_ITEM::GetAnchor( int n ) const
pt0 = pad->ShapePos(); pt0 = pad->ShapePos();
VECTOR2I pt1 = pt0; VECTOR2I pt1 = pt0;
switch( pad->GetShape() )
{
case PAD_SHAPE_RECT:
case PAD_SHAPE_CIRCLE:
case PAD_SHAPE_OVAL:
case PAD_SHAPE_ROUNDRECT:
case PAD_SHAPE_CHAMFERED_RECT:
switch( n )
{
case 1: pt1.y -= pad->GetSize().y / 2; break; // North
case 2: pt1.y += pad->GetSize().y / 2; break; // South
case 3: pt1.x -= pad->GetSize().x / 2; break; // East
case 4: pt1.x += pad->GetSize().x / 2; break; // West
default: break; // Wicked witch
}
if( pad->GetOrientation() )
RotatePoint( pt1, pad->ShapePos(), pad->GetOrientation() );
// Thermal spokes on circular pads form an 'X' instead of a '+'
if( pad->GetShape() == PAD_SHAPE_CIRCLE )
RotatePoint( pt1, pad->ShapePos(), 450 );
return pt1;
case PAD_SHAPE_TRAPEZOID:
case PAD_SHAPE_CUSTOM:
{
switch( n ) switch( n )
{ {
case 1: pt1.y = m_bbox.GetTop(); break; // North case 1: pt1.y = m_bbox.GetTop(); break; // North
@ -72,22 +100,9 @@ const VECTOR2I CN_ITEM::GetAnchor( int n ) const
default: break; // Wicked witch default: break; // Wicked witch
} }
switch( pad->GetShape() ) if( pad->GetOrientation() )
{ RotatePoint( pt1, pad->ShapePos(), pad->GetOrientation() );
case PAD_SHAPE_RECT:
case PAD_SHAPE_OVAL:
case PAD_SHAPE_ROUNDRECT:
case PAD_SHAPE_CHAMFERED_RECT:
return pt1;
case PAD_SHAPE_CIRCLE:
// Thermal spokes on circular pads form an 'X' instead of a '+'
RotatePoint( pt1, pad->ShapePos(), 450 );
return pt1;
case PAD_SHAPE_TRAPEZOID:
case PAD_SHAPE_CUSTOM:
{
SHAPE_POLY_SET padPolySet; SHAPE_POLY_SET padPolySet;
pad->BuildPadShapePolygon( padPolySet, wxSize( 0, 0 ), ARC_LOW_DEF ); pad->BuildPadShapePolygon( padPolySet, wxSize( 0, 0 ), ARC_LOW_DEF );
const SHAPE_LINE_CHAIN& padOutline = padPolySet.COutline( 0 ); const SHAPE_LINE_CHAIN& padOutline = padPolySet.COutline( 0 );