Handle more pad shapes when building diffpair gateways.

Fixes https://gitlab.com/kicad/code/kicad/issues/1883
This commit is contained in:
Jeff Young 2023-04-08 23:25:53 +01:00
parent 374d3d52ef
commit 1d19672054
2 changed files with 24 additions and 5 deletions

View File

@ -460,6 +460,10 @@ void DP_GATEWAYS::BuildFromPrimitivePair( const DP_PRIMITIVE_PAIR& aPair, bool a
switch( shP->Type() )
{
case SH_CIRCLE:
BuildGeneric ( p0_p, p0_n, true );
return;
case SH_RECT:
{
int w = static_cast<const SHAPE_RECT*>( shP )->GetWidth();
@ -483,9 +487,26 @@ void DP_GATEWAYS::BuildFromPrimitivePair( const DP_PRIMITIVE_PAIR& aPair, bool a
break;
}
case SH_SIMPLE:
case SH_COMPOUND:
{
BOX2I bbox = shP->BBox();
int w = bbox.GetWidth();
int h = bbox.GetHeight();
if( w < h )
std::swap( w, h );
orthoFanDistance = ( w + 1 )* 3 / 2;
diagFanDistance = ( w - h );
break;
}
default:
BuildGeneric ( p0_p, p0_n, true );
return;
wxFAIL_MSG( wxString::Format( wxT( "Unsupported starting primitive: %d (%s)." ),
shP->Type(),
SHAPE_TYPE_asString( shP->Type() ) ) );
break;
}
if( checkDiagonalAlignment( p0_p, p0_n ) )

View File

@ -78,17 +78,15 @@ static const SHAPE_LINE_CHAIN buildHullForPrimitiveShape( const SHAPE* aShape, i
case SH_SIMPLE:
{
const SHAPE_SIMPLE* convex = static_cast<const SHAPE_SIMPLE*>( aShape );
return ConvexHull( *convex, cl );
}
default:
{
wxFAIL_MSG( wxString::Format( wxT( "Unsupported hull shape: %d (%s)." ),
aShape->Type(),
SHAPE_TYPE_asString( aShape->Type() ) ) );
break;
}
}
return SHAPE_LINE_CHAIN();
}