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
(cherry picked from commit dba2fdb6d3
)
This commit is contained in:
parent
1c639714f3
commit
2b09653abb
|
@ -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,6 +176,7 @@ void GRAPHICS_IMPORTER_LIB_SYMBOL::AddPolygon( const std::vector<VECTOR2D>& aVer
|
|||
|
||||
polygon->SetStroke( MapStrokeParams( aStroke ) );
|
||||
|
||||
if( polygon->IsPolyShapeValid() )
|
||||
addItem( std::move( polygon ) );
|
||||
}
|
||||
|
||||
|
|
|
@ -171,6 +171,8 @@ void GRAPHICS_IMPORTER_PCBNEW::AddPolygon( const std::vector<VECTOR2D>& aVertice
|
|||
}
|
||||
|
||||
polygon->SetStroke( MapStrokeParams( aStroke ) );
|
||||
|
||||
if( polygon->IsPolyShapeValid() )
|
||||
addItem( std::move( polygon ) );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue