Optimize makeEffectiveShapes for polygons.

This commit is contained in:
Alex Shvartzkop 2023-08-20 14:29:02 +03:00
parent f211b2cdd0
commit 5b438d6398
1 changed files with 8 additions and 6 deletions

View File

@ -1221,18 +1221,20 @@ std::vector<SHAPE*> EDA_SHAPE::makeEffectiveShapes( bool aEdgeOnly, bool aLineCh
for( int ii = 0; ii < GetPolyShape().OutlineCount(); ++ii )
{
SHAPE_LINE_CHAIN l = GetPolyShape().COutline( ii );
if( aLineChainOnly )
l.SetClosed( false );
const SHAPE_LINE_CHAIN& l = GetPolyShape().COutline( ii );
if( IsFilled() && !aEdgeOnly )
effectiveShapes.emplace_back( new SHAPE_SIMPLE( l ) );
if( width > 0 || !IsFilled() || aEdgeOnly )
{
for( int jj = 0; jj < l.SegmentCount(); jj++ )
effectiveShapes.emplace_back( new SHAPE_SEGMENT( l.Segment( jj ), width ) );
int segCount = l.SegmentCount();
if( aLineChainOnly && l.IsClosed() )
segCount--; // Treat closed chain as open
for( int jj = 0; jj < segCount; jj++ )
effectiveShapes.emplace_back( new SHAPE_SEGMENT( l.CSegment( jj ), width ) );
}
}
}