Don't treat success == true as "we got an outline".

It just means the outline wasn't malformed.  It might still be
empty.

[Edit: my fix collided with JP's, so all this really is now is a
couple of slight performance improvements.]
This commit is contained in:
Jeff Young 2021-02-10 12:35:09 +00:00
parent 05d2053ded
commit 4679682fe9
1 changed files with 14 additions and 10 deletions

View File

@ -1092,8 +1092,18 @@ bool BuildFootprintPolygonOutlines( BOARD* aBoard, SHAPE_POLY_SET& aOutlines, in
int aChainingEpsilon, OUTLINE_ERROR_HANDLER* aErrorHandler ) int aChainingEpsilon, OUTLINE_ERROR_HANDLER* aErrorHandler )
{ {
FOOTPRINT* footprint = aBoard->GetFirstFootprint();
// No footprint loaded
if( !footprint )
{
wxLogTrace( traceBoardOutline, "No footprint found on board" );
return false;
}
PCB_TYPE_COLLECTOR items; PCB_TYPE_COLLECTOR items;
SHAPE_POLY_SET outlines; SHAPE_POLY_SET outlines;
bool success = false;
// Get all the SHAPEs into 'items', then keep only those on layer == Edge_Cuts. // Get all the SHAPEs into 'items', then keep only those on layer == Edge_Cuts.
static const KICAD_T scan_graphics[] = { PCB_SHAPE_T, PCB_FP_SHAPE_T, EOT }; static const KICAD_T scan_graphics[] = { PCB_SHAPE_T, PCB_FP_SHAPE_T, EOT };
@ -1108,20 +1118,14 @@ bool BuildFootprintPolygonOutlines( BOARD* aBoard, SHAPE_POLY_SET& aOutlines, in
segList.push_back( static_cast<PCB_SHAPE*>( items[ii] ) ); segList.push_back( static_cast<PCB_SHAPE*>( items[ii] ) );
} }
bool success = ConvertOutlineToPolygon( segList, outlines, aErrorMax, aChainingEpsilon, if( !segList.empty() )
aErrorHandler );
FOOTPRINT* footprint = aBoard->GetFirstFootprint();
// No footprint loaded
if( !footprint )
{ {
wxLogTrace( traceBoardOutline, "No footprint found on board" ); success = ConvertOutlineToPolygon( segList, outlines, aErrorMax, aChainingEpsilon,
return false; aErrorHandler );
} }
// A closed outline was found on Edge_Cuts // A closed outline was found on Edge_Cuts
if( success && outlines.OutlineCount() ) if( success )
{ {
wxLogTrace( traceBoardOutline, "Closed outline found" ); wxLogTrace( traceBoardOutline, "Closed outline found" );