mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 18:23:15 +02:00
ODB++: Fix handling of polygon outlines
The ODB format only supports the concept of a filled polygon, not one with a stroke outline. Use line features for these instead.
This commit is contained in:
parent
82fc1408e2
commit
044643b164
@ -134,6 +134,7 @@ void FEATURES_MANAGER::AddShape( const PCB_SHAPE& aShape, PCB_LAYER_ID aLayer )
|
|||||||
|
|
||||||
if( aLayer != UNDEFINED_LAYER && LSET( { F_Mask, B_Mask } ).Contains( aLayer ) )
|
if( aLayer != UNDEFINED_LAYER && LSET( { F_Mask, B_Mask } ).Contains( aLayer ) )
|
||||||
soldermask_min_thickness = aShape.GetWidth();
|
soldermask_min_thickness = aShape.GetWidth();
|
||||||
|
|
||||||
int maxError = m_board->GetDesignSettings().m_MaxError;
|
int maxError = m_board->GetDesignSettings().m_MaxError;
|
||||||
SHAPE_POLY_SET poly_set;
|
SHAPE_POLY_SET poly_set;
|
||||||
|
|
||||||
@ -158,14 +159,36 @@ void FEATURES_MANAGER::AddShape( const PCB_SHAPE& aShape, PCB_LAYER_ID aLayer )
|
|||||||
poly_set.Fracture( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
|
poly_set.Fracture( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int strokeWidth = aShape.GetStroke().GetWidth();
|
||||||
|
|
||||||
|
// ODB++ surface features can only represent closed polygons. We add a surface for
|
||||||
|
// the fill of the shape, if present, and add line segments for the outline, if present.
|
||||||
|
if( aShape.IsFilled() )
|
||||||
|
{
|
||||||
for( int ii = 0; ii < poly_set.OutlineCount(); ++ii )
|
for( int ii = 0; ii < poly_set.OutlineCount(); ++ii )
|
||||||
{
|
|
||||||
if( aShape.GetFillMode() != FILL_T::NO_FILL )
|
|
||||||
{
|
{
|
||||||
AddContour( poly_set, ii, FILL_T::FILLED_SHAPE );
|
AddContour( poly_set, ii, FILL_T::FILLED_SHAPE );
|
||||||
}
|
|
||||||
|
|
||||||
AddContour( poly_set, ii, FILL_T::NO_FILL );
|
if( strokeWidth != 0 )
|
||||||
|
{
|
||||||
|
for( int jj = 0; jj < poly_set.COutline( ii ).SegmentCount(); ++jj )
|
||||||
|
{
|
||||||
|
const SEG& seg = poly_set.COutline( ii ).CSegment( jj );
|
||||||
|
AddFeatureLine( seg.A, seg.B, strokeWidth );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for( int ii = 0; ii < poly_set.OutlineCount(); ++ii )
|
||||||
|
{
|
||||||
|
for( int jj = 0; jj < poly_set.COutline( ii ).SegmentCount(); ++jj )
|
||||||
|
{
|
||||||
|
const SEG& seg = poly_set.COutline( ii ).CSegment( jj );
|
||||||
|
AddFeatureLine( seg.A, seg.B, strokeWidth );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user