mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 02:03:12 +02:00
fix issues in ROUNDRECT. This also fix a change commit by mistake in aeafbe48
Fix incorrect ROUNDRECT Ctor. It also fixes a link issue on msys2 - Do not throw an error in CTor: this is not the place. It is much easy to fix the value of incorrect radius. Moreover, the Ctor is called without catching a throw-ed error in code. - fix the test about radius validity, broken.
This commit is contained in:
parent
1a3f6028f8
commit
6592c75345
@ -25,11 +25,8 @@
|
||||
|
||||
#include "geometry/roundrect.h"
|
||||
|
||||
#include <ki_exception.h>
|
||||
|
||||
#include <geometry/shape_poly_set.h>
|
||||
#include <geometry/shape_utils.h>
|
||||
#include <wx/intl.h>
|
||||
|
||||
|
||||
namespace
|
||||
@ -55,28 +52,12 @@ ROUNDRECT::ROUNDRECT( SHAPE_RECT aRect, int aRadius ) :
|
||||
m_rect( std::move( aRect ) ),
|
||||
m_radius( aRadius )
|
||||
{
|
||||
#if !defined( __MINGW32__ )
|
||||
if( m_radius > m_rect.MajorDimension() )
|
||||
{
|
||||
throw KI_PARAM_ERROR(
|
||||
_( "Roundrect radius is larger than the rectangle's major dimension" ) );
|
||||
}
|
||||
// Ensure radius is compatible with rectangle size:
|
||||
if( m_radius > m_rect.MinorDimension()/2 )
|
||||
m_radius = m_rect.MinorDimension()/2;
|
||||
|
||||
if( m_radius < 0 )
|
||||
{
|
||||
throw KI_PARAM_ERROR( _( "Roundrect radius must be non-negative" ) );
|
||||
}
|
||||
#else
|
||||
if( m_radius > m_rect.MajorDimension() )
|
||||
{
|
||||
throw std::invalid_argument( "Roundrect radius is larger than the rectangle's major dimension" );
|
||||
}
|
||||
|
||||
if( m_radius < 0 )
|
||||
{
|
||||
throw std::invalid_argument( "Roundrect radius must be non-negative" );
|
||||
}
|
||||
#endif
|
||||
m_radius = 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -34,7 +34,6 @@
|
||||
#include <pcb_track.h>
|
||||
#include <tools/pcb_tool_utils.h>
|
||||
#include <confirm.h>
|
||||
#include <ki_exception.h>
|
||||
|
||||
namespace
|
||||
{
|
||||
@ -907,9 +906,9 @@ void OUTSET_ROUTINE::ProcessItem( BOARD_ITEM& aItem )
|
||||
rrect.TransformToPolygon( poly );
|
||||
addPoly( poly );
|
||||
}
|
||||
catch( const KI_PARAM_ERROR& error )
|
||||
catch( ... )
|
||||
{
|
||||
DisplayErrorMessage( nullptr, error.What() );
|
||||
DisplayErrorMessage( nullptr, _( "Cannot create rectangle outset" ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user