Don't construct an arc if we won't need it in pcbnew gfx importer.
(cherry picked from commit d34df3e951
)
Co-authored-by: Alex Shvartzkop <dudesuchamazing@gmail.com>
This commit is contained in:
parent
ca18112041
commit
bc3ae8ca51
|
@ -111,10 +111,6 @@ void GRAPHICS_IMPORTER_PCBNEW::AddCircle( const VECTOR2D& aCenter, double aRadiu
|
|||
void GRAPHICS_IMPORTER_PCBNEW::AddArc( const VECTOR2D& aCenter, const VECTOR2D& aStart,
|
||||
const EDA_ANGLE& aAngle, const IMPORTED_STROKE& aStroke )
|
||||
{
|
||||
std::unique_ptr<PCB_SHAPE> arc = std::make_unique<PCB_SHAPE>( m_parent );
|
||||
arc->SetShape( SHAPE_T::ARC );
|
||||
arc->SetLayer( GetLayer() );
|
||||
|
||||
/**
|
||||
* We need to perform the rotation/conversion here while still using floating point values
|
||||
* to avoid rounding errors when operating in integer space in pcbnew
|
||||
|
@ -125,8 +121,6 @@ void GRAPHICS_IMPORTER_PCBNEW::AddArc( const VECTOR2D& aCenter, const VECTOR2D&
|
|||
RotatePoint( end, aCenter, -aAngle );
|
||||
RotatePoint( mid, aCenter, -aAngle / 2.0 );
|
||||
|
||||
arc->SetArcGeometry( MapCoordinate( aStart ), MapCoordinate( mid ), MapCoordinate( end ) );
|
||||
|
||||
// Ensure the arc can be handled by Pcbnew. Arcs with a too big radius cannot.
|
||||
// The criteria used here is radius < MAX_INT / 2.
|
||||
// this is not perfect, but we do not know the exact final position of the arc, so
|
||||
|
@ -142,6 +136,11 @@ void GRAPHICS_IMPORTER_PCBNEW::AddArc( const VECTOR2D& aCenter, const VECTOR2D&
|
|||
return;
|
||||
}
|
||||
|
||||
std::unique_ptr<PCB_SHAPE> arc = std::make_unique<PCB_SHAPE>( m_parent );
|
||||
arc->SetShape( SHAPE_T::ARC );
|
||||
arc->SetLayer( GetLayer() );
|
||||
|
||||
arc->SetArcGeometry( MapCoordinate( aStart ), MapCoordinate( mid ), MapCoordinate( end ) );
|
||||
arc->SetStroke( MapStrokeParams( aStroke ) );
|
||||
|
||||
addItem( std::move( arc ) );
|
||||
|
|
Loading…
Reference in New Issue