Graphics import: support open polygons.

This commit is contained in:
Alex Shvartzkop 2023-11-04 17:09:16 +03:00
parent 23063fa976
commit 48855ebe40
1 changed files with 11 additions and 1 deletions

View File

@ -144,10 +144,17 @@ static void convertPolygon( std::list<std::unique_ptr<IMPORTED_SHAPE>>& aShapes,
upscaledW = ( origW == 0.0f ? 0.0 : origW * convert_scale / origH );
}
std::vector<SHAPE_LINE_CHAIN> upscaledPaths;
std::vector<IMPORTED_POLYGON*> openPaths;
std::vector<SHAPE_LINE_CHAIN> upscaledPaths;
for( IMPORTED_POLYGON* path : aPaths )
{
if( path->Vertices().size() < 3 )
{
openPaths.push_back( path );
continue;
}
SHAPE_LINE_CHAIN lc;
for( VECTOR2D& v : path->Vertices() )
@ -178,6 +185,9 @@ static void convertPolygon( std::list<std::unique_ptr<IMPORTED_SHAPE>>& aShapes,
aShapes.push_back(
std::make_unique<IMPORTED_POLYGON>( pts, aStroke, aFilled, aFillColor ) );
}
for( IMPORTED_POLYGON* openPath : openPaths )
aShapes.push_back( std::make_unique<IMPORTED_POLYGON>( *openPath ) );
}