Don't import invalid polygons.
If we *do* get a 2-point polygon in SVG, import it as a segment. Fixes https://gitlab.com/kicad/code/kicad/-/issues/17091
This commit is contained in:
parent
4056428a08
commit
dba2fdb6d3
|
@ -261,7 +261,7 @@ void SVG_IMPORT_PLUGIN::DrawPath( const float* aPoints, int aNumPoints, bool aCl
|
|||
if( aNumPoints > 0 )
|
||||
DrawCubicBezierPath( aPoints, aNumPoints, collectedPathPoints );
|
||||
|
||||
if( aClosedPath )
|
||||
if( aClosedPath && collectedPathPoints.size() > 2 )
|
||||
DrawPolygon( collectedPathPoints, aStroke, aFilled, aFillColor );
|
||||
else
|
||||
DrawLineSegments( collectedPathPoints, aStroke );
|
||||
|
|
|
@ -176,7 +176,8 @@ void GRAPHICS_IMPORTER_LIB_SYMBOL::AddPolygon( const std::vector<VECTOR2D>& aVer
|
|||
|
||||
polygon->SetStroke( MapStrokeParams( aStroke ) );
|
||||
|
||||
addItem( std::move( polygon ) );
|
||||
if( polygon->IsPolyShapeValid() )
|
||||
addItem( std::move( polygon ) );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -171,7 +171,9 @@ void GRAPHICS_IMPORTER_PCBNEW::AddPolygon( const std::vector<VECTOR2D>& aVertice
|
|||
}
|
||||
|
||||
polygon->SetStroke( MapStrokeParams( aStroke ) );
|
||||
addItem( std::move( polygon ) );
|
||||
|
||||
if( polygon->IsPolyShapeValid() )
|
||||
addItem( std::move( polygon ) );
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue