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 )
|
if( aNumPoints > 0 )
|
||||||
DrawCubicBezierPath( aPoints, aNumPoints, collectedPathPoints );
|
DrawCubicBezierPath( aPoints, aNumPoints, collectedPathPoints );
|
||||||
|
|
||||||
if( aClosedPath )
|
if( aClosedPath && collectedPathPoints.size() > 2 )
|
||||||
DrawPolygon( collectedPathPoints, aStroke, aFilled, aFillColor );
|
DrawPolygon( collectedPathPoints, aStroke, aFilled, aFillColor );
|
||||||
else
|
else
|
||||||
DrawLineSegments( collectedPathPoints, aStroke );
|
DrawLineSegments( collectedPathPoints, aStroke );
|
||||||
|
|
|
@ -176,7 +176,8 @@ void GRAPHICS_IMPORTER_LIB_SYMBOL::AddPolygon( const std::vector<VECTOR2D>& aVer
|
||||||
|
|
||||||
polygon->SetStroke( MapStrokeParams( aStroke ) );
|
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 ) );
|
polygon->SetStroke( MapStrokeParams( aStroke ) );
|
||||||
addItem( std::move( polygon ) );
|
|
||||||
|
if( polygon->IsPolyShapeValid() )
|
||||||
|
addItem( std::move( polygon ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue