Normalize phase angles.

This commit is contained in:
Jeff Young 2024-06-14 19:01:13 +01:00
parent 245894e8eb
commit 944ee4af7d
1 changed files with 10 additions and 10 deletions

View File

@ -35,6 +35,7 @@
#include <confirm.h>
#include <common.h>
#include <locale_io.h>
#include <geometry/eda_angle.h>
void SPICE_VALUE_FORMAT::FromString( const wxString& aString )
@ -223,18 +224,17 @@ wxString SPICE_VALUE::ToString( const SPICE_VALUE_FORMAT& aFormat )
{
wxString range( aFormat.Range );
if( range.EndsWith( wxS( "°" ) ) )
{
EDA_ANGLE angle( m_base * std::pow( 10, (int) m_prefix ), DEGREES_T );
angle.Normalize180();
return wxString::FromCDouble( angle.AsDegrees(), aFormat.Precision ) + wxS( "°" );
}
if( range.StartsWith( wxS( "~" ) ) )
{
// Don't use SI prefixes with degrees unless they specifically ask for it.
if( range.EndsWith( wxS( "°" ) ) )
{
range = range.Right( range.Length() - 1 );
}
else
{
Normalize();
range = si_prefix( m_prefix ) + range.Right( range.Length() - 1 );
}
Normalize();
range = si_prefix( m_prefix ) + range.Right( range.Length() - 1 );
}
else
{