Normalize phase angles.
This commit is contained in:
parent
a2cbd1ff21
commit
ac576d7e0a
|
@ -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,19 +224,18 @@ wxString SPICE_VALUE::ToString( const SPICE_VALUE_FORMAT& aFormat )
|
|||
{
|
||||
wxString range( aFormat.Range );
|
||||
|
||||
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 );
|
||||
EDA_ANGLE angle( m_base * std::pow( 10, (int) m_prefix ), DEGREES_T );
|
||||
angle.Normalize180();
|
||||
return wxString::FromCDouble( angle.AsDegrees(), aFormat.Precision ) + wxS( "°" );
|
||||
}
|
||||
else
|
||||
|
||||
if( range.StartsWith( wxS( "~" ) ) )
|
||||
{
|
||||
Normalize();
|
||||
range = si_prefix( m_prefix ) + range.Right( range.Length() - 1 );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SPICE_VALUE::UNIT_PREFIX rangePrefix = ParseSIPrefix( range[0] );
|
||||
|
|
Loading…
Reference in New Issue