Add checks against missing D-Codes in flashed Gerber items
Fixes: lp:1756710 * https://bugs.launchpad.net/kicad/+bug/1756710
This commit is contained in:
parent
aa0ae48dda
commit
4e76a18d5d
|
@ -320,37 +320,49 @@ const EDA_RECT GERBER_DRAW_ITEM::GetBoundingBox() const
|
||||||
|
|
||||||
case GBR_SPOT_CIRCLE:
|
case GBR_SPOT_CIRCLE:
|
||||||
{
|
{
|
||||||
int radius = code->m_Size.x >> 1;
|
if( code )
|
||||||
bbox.Inflate( radius, radius );
|
{
|
||||||
|
int radius = code->m_Size.x >> 1;
|
||||||
|
bbox.Inflate( radius, radius );
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case GBR_SPOT_RECT:
|
case GBR_SPOT_RECT:
|
||||||
{
|
{
|
||||||
bbox.Inflate( code->m_Size.x / 2, code->m_Size.y / 2 );
|
if( code )
|
||||||
|
bbox.Inflate( code->m_Size.x / 2, code->m_Size.y / 2 );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case GBR_SPOT_OVAL:
|
case GBR_SPOT_OVAL:
|
||||||
{
|
{
|
||||||
bbox.Inflate( code->m_Size.x, code->m_Size.y );
|
if( code )
|
||||||
|
bbox.Inflate( code->m_Size.x, code->m_Size.y );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case GBR_SPOT_POLY:
|
case GBR_SPOT_POLY:
|
||||||
{
|
{
|
||||||
if( code->m_Polygon.OutlineCount() == 0 )
|
if( code )
|
||||||
code->ConvertShapeToPolygon();
|
{
|
||||||
|
if( code->m_Polygon.OutlineCount() == 0 )
|
||||||
|
code->ConvertShapeToPolygon();
|
||||||
|
|
||||||
bbox.Inflate( code->m_Polygon.BBox().GetWidth() / 2, code->m_Polygon.BBox().GetHeight() / 2 );
|
bbox.Inflate( code->m_Polygon.BBox().GetWidth() / 2,
|
||||||
|
code->m_Polygon.BBox().GetHeight() / 2 );
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GBR_SPOT_MACRO:
|
case GBR_SPOT_MACRO:
|
||||||
{
|
{
|
||||||
// Update the shape drawings and the bounding box coordiantes:
|
if( code )
|
||||||
code->GetMacro()->GetApertureMacroShape( this, m_Start );
|
{
|
||||||
// now the bounding box is valid:
|
// Update the shape drawings and the bounding box coordiantes:
|
||||||
bbox = code->GetMacro()->GetBoundingBox();
|
code->GetMacro()->GetApertureMacroShape( this, m_Start );
|
||||||
|
// now the bounding box is valid:
|
||||||
|
bbox = code->GetMacro()->GetBoundingBox();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -406,6 +406,9 @@ void GERBVIEW_PAINTER::drawFlashedShape( GERBER_DRAW_ITEM* aItem, bool aFilled )
|
||||||
|
|
||||||
wxASSERT_MSG( code, wxT( "drawFlashedShape: Item has no D_CODE!" ) );
|
wxASSERT_MSG( code, wxT( "drawFlashedShape: Item has no D_CODE!" ) );
|
||||||
|
|
||||||
|
if( !code )
|
||||||
|
return;
|
||||||
|
|
||||||
m_gal->SetIsFill( aFilled );
|
m_gal->SetIsFill( aFilled );
|
||||||
m_gal->SetIsStroke( !aFilled );
|
m_gal->SetIsStroke( !aFilled );
|
||||||
m_gal->SetLineWidth( m_gerbviewSettings.m_outlineWidth );
|
m_gal->SetLineWidth( m_gerbviewSettings.m_outlineWidth );
|
||||||
|
|
Loading…
Reference in New Issue