PNS: Add defensive coding to AlternateShape()
Adds additional check/warnings about missing alternate shapes when they are expected. Fixes https://gitlab.com/kicad/code/kicad/issues/5233
This commit is contained in:
parent
87b078927c
commit
dd9f7c8c25
|
@ -34,13 +34,24 @@ void INDEX::Add( ITEM* aItem )
|
||||||
|
|
||||||
for( int i = range.Start(); i <= range.End(); ++i )
|
for( int i = range.Start(); i <= range.End(); ++i )
|
||||||
{
|
{
|
||||||
if( ROUTER::GetInstance()->GetInterface()->IsPadOnLayer( aItem, i )
|
if( !ROUTER::GetInstance()->GetInterface()->IsPadOnLayer( aItem, i ) )
|
||||||
&& aItem->AlternateShape() )
|
{
|
||||||
|
if( aItem->AlternateShape() )
|
||||||
m_subIndices[i].Add( aItem, aItem->AlternateShape()->BBox() );
|
m_subIndices[i].Add( aItem, aItem->AlternateShape()->BBox() );
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
wxLogError( "Missing expected Alternate shape for %s at %d %d",
|
||||||
|
aItem->Parent()->GetClass(), aItem->Anchor( 0 ).x, aItem->Anchor( 0 ).y );
|
||||||
m_subIndices[i].Add( aItem );
|
m_subIndices[i].Add( aItem );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_subIndices[i].Add( aItem );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
m_allItems.insert( aItem );
|
m_allItems.insert( aItem );
|
||||||
int net = aItem->Net();
|
int net = aItem->Net();
|
||||||
|
|
||||||
|
|
|
@ -45,12 +45,22 @@ bool ITEM::collideSimple( const ITEM* aOther, int aClearance, bool aNeedMTV, VEC
|
||||||
if( !aOther->Layers().IsMultilayer()
|
if( !aOther->Layers().IsMultilayer()
|
||||||
&& !ROUTER::GetInstance()->GetInterface()->IsPadOnLayer( this, aOther->Layer() ) )
|
&& !ROUTER::GetInstance()->GetInterface()->IsPadOnLayer( this, aOther->Layer() ) )
|
||||||
{
|
{
|
||||||
|
if( !AlternateShape() )
|
||||||
|
wxLogError
|
||||||
|
( "Missing expected Alternate shape for %s at %d %d", m_parent->GetClass(),
|
||||||
|
Anchor( 0 ).x, Anchor( 0 ).y );
|
||||||
|
else
|
||||||
shapeA = AlternateShape();
|
shapeA = AlternateShape();
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !Layers().IsMultilayer()
|
if( !Layers().IsMultilayer()
|
||||||
&& !ROUTER::GetInstance()->GetInterface()->IsPadOnLayer( aOther, Layer() ) )
|
&& !ROUTER::GetInstance()->GetInterface()->IsPadOnLayer( aOther, Layer() ) )
|
||||||
{
|
{
|
||||||
|
if( !aOther->AlternateShape() )
|
||||||
|
wxLogError
|
||||||
|
( "Missing expected Alternate shape for %s at %d %d", aOther->Parent()->GetClass(),
|
||||||
|
aOther->Anchor( 0 ).x, aOther->Anchor( 0 ).y );
|
||||||
|
else
|
||||||
shapeB = aOther->AlternateShape();
|
shapeB = aOther->AlternateShape();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue