Gerbview: Fix incorrect rendering of aperture macros combining polygons.
A aperture macro can have polygons with holes, and/or many polygons. When combining polygons holes can be created. So ensure the resulting polygon is fractured before drawing it. Fixes #11218 https://gitlab.com/kicad/code/kicad/issues/11218
This commit is contained in:
parent
b87fc45e33
commit
e2cda7837f
|
@ -817,7 +817,6 @@ SHAPE_POLY_SET* APERTURE_MACRO::GetApertureMacroShape( const GERBER_DRAW_ITEM* a
|
||||||
const VECTOR2I& aShapePos )
|
const VECTOR2I& aShapePos )
|
||||||
{
|
{
|
||||||
SHAPE_POLY_SET holeBuffer;
|
SHAPE_POLY_SET holeBuffer;
|
||||||
bool hasHole = false;
|
|
||||||
|
|
||||||
m_shape.RemoveAllContours();
|
m_shape.RemoveAllContours();
|
||||||
|
|
||||||
|
@ -839,7 +838,6 @@ SHAPE_POLY_SET* APERTURE_MACRO::GetApertureMacroShape( const GERBER_DRAW_ITEM* a
|
||||||
{
|
{
|
||||||
m_shape.BooleanSubtract( holeBuffer, SHAPE_POLY_SET::PM_FAST );
|
m_shape.BooleanSubtract( holeBuffer, SHAPE_POLY_SET::PM_FAST );
|
||||||
holeBuffer.RemoveAllContours();
|
holeBuffer.RemoveAllContours();
|
||||||
hasHole = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -847,9 +845,9 @@ SHAPE_POLY_SET* APERTURE_MACRO::GetApertureMacroShape( const GERBER_DRAW_ITEM* a
|
||||||
// Merge and cleanup basic shape polygons
|
// Merge and cleanup basic shape polygons
|
||||||
m_shape.Simplify( SHAPE_POLY_SET::PM_FAST );
|
m_shape.Simplify( SHAPE_POLY_SET::PM_FAST );
|
||||||
|
|
||||||
// If a hole is defined inside a polygon, we must fracture the polygon
|
// A hole can be is defined inside a polygon, or the polygons themselve can create
|
||||||
// to be able to drawn it (i.e link holes by overlapping edges)
|
// a hole when merged, so we must fracture the polygon to be able to drawn it
|
||||||
if( hasHole )
|
// (i.e link holes by overlapping edges)
|
||||||
m_shape.Fracture( SHAPE_POLY_SET::PM_FAST );
|
m_shape.Fracture( SHAPE_POLY_SET::PM_FAST );
|
||||||
|
|
||||||
m_boundingBox = EDA_RECT( VECTOR2I( 0, 0 ), VECTOR2I( 1, 1 ) );
|
m_boundingBox = EDA_RECT( VECTOR2I( 0, 0 ), VECTOR2I( 1, 1 ) );
|
||||||
|
|
Loading…
Reference in New Issue