mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 02:03:12 +02:00
Handle corner radius in Create from selection
Fixes https://gitlab.com/kicad/code/kicad/-/issues/21601
This commit is contained in:
parent
aeafbe48fe
commit
0f1b514964
@ -2300,6 +2300,26 @@ void EDA_SHAPE::TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, int aClearance
|
||||
}
|
||||
|
||||
case SHAPE_T::RECTANGLE:
|
||||
{
|
||||
if( GetCornerRadius() > 0 )
|
||||
{
|
||||
// Use specialized function for rounded rectangles
|
||||
VECTOR2I size( GetRectangleWidth(), GetRectangleHeight() );
|
||||
VECTOR2I position = GetStart() + size / 2; // Center position
|
||||
|
||||
TransformRoundChamferedRectToPolygon( aBuffer, position, size, ANGLE_0,
|
||||
GetCornerRadius(), 0.0, 0,
|
||||
solidFill ? 0 : width / 2, aError, aErrorLoc );
|
||||
|
||||
if( solidFill && width > 0 )
|
||||
{
|
||||
// Add outline for filled shapes with border
|
||||
TransformRoundChamferedRectToPolygon( aBuffer, position, size, ANGLE_0,
|
||||
GetCornerRadius(), 0.0, 0,
|
||||
width / 2, aError, aErrorLoc );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::vector<VECTOR2I> pts = GetRectCorners();
|
||||
|
||||
@ -2319,6 +2339,7 @@ void EDA_SHAPE::TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, int aClearance
|
||||
TransformOvalToPolygon( aBuffer, pts[2], pts[3], width, aError, aErrorLoc );
|
||||
TransformOvalToPolygon( aBuffer, pts[3], pts[0], width, aError, aErrorLoc );
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -978,24 +978,14 @@ int CONVERT_TOOL::CreateLines( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
PCB_SHAPE* graphic = static_cast<PCB_SHAPE*>( aItem );
|
||||
|
||||
if( graphic->GetShape() == SHAPE_T::POLY )
|
||||
if( graphic->GetShape() == SHAPE_T::RECTANGLE )
|
||||
{
|
||||
graphic->TransformShapeToPolygon( set, graphic->GetLayer(), 0, graphic->GetMaxError(), ERROR_INSIDE );
|
||||
}
|
||||
else if( graphic->GetShape() == SHAPE_T::POLY )
|
||||
{
|
||||
set = graphic->GetPolyShape();
|
||||
}
|
||||
else if( graphic->GetShape() == SHAPE_T::RECTANGLE )
|
||||
{
|
||||
SHAPE_LINE_CHAIN outline;
|
||||
VECTOR2I start( graphic->GetStart() );
|
||||
VECTOR2I end( graphic->GetEnd() );
|
||||
|
||||
outline.Append( start );
|
||||
outline.Append( VECTOR2I( end.x, start.y ) );
|
||||
outline.Append( end );
|
||||
outline.Append( VECTOR2I( start.x, end.y ) );
|
||||
outline.SetClosed( true );
|
||||
|
||||
set.AddOutline( outline );
|
||||
}
|
||||
else
|
||||
{
|
||||
wxFAIL_MSG( wxT( "Unhandled graphic shape type in PolyToLines - getPolySet" ) );
|
||||
|
Loading…
x
Reference in New Issue
Block a user