Excise deci-degrees from UNIT_BINDER.
Fixes https://gitlab.com/kicad/code/kicad/issues/10495
This commit is contained in:
parent
57afdf153d
commit
0091c76a6f
|
@ -220,7 +220,7 @@ void PANEL_PREVIEW_3D_MODEL::loadSettings()
|
|||
*/
|
||||
static double rotationFromString( const wxString& aValue )
|
||||
{
|
||||
double rotation = DoubleValueFromString( EDA_UNITS::DEGREES, aValue ) / 10.0;
|
||||
double rotation = DoubleValueFromString( EDA_UNITS::DEGREES, aValue );
|
||||
|
||||
if( rotation > MAX_ROTATION )
|
||||
{
|
||||
|
@ -376,7 +376,7 @@ void PANEL_PREVIEW_3D_MODEL::doIncrementRotation( wxSpinEvent& aEvent, double aS
|
|||
else if( spinCtrl == m_spinZrot )
|
||||
textCtrl = zrot;
|
||||
|
||||
double curr_value = DoubleValueFromString( EDA_UNITS::DEGREES, textCtrl->GetValue() ) / 10.0;
|
||||
double curr_value = DoubleValueFromString( EDA_UNITS::DEGREES, textCtrl->GetValue() );
|
||||
|
||||
curr_value += ( ROTATION_INCREMENT * aSign );
|
||||
curr_value = std::max( -MAX_ROTATION, curr_value );
|
||||
|
@ -447,7 +447,7 @@ void PANEL_PREVIEW_3D_MODEL::onMouseWheelRot( wxMouseEvent& event )
|
|||
if( event.GetWheelRotation() >= 0 )
|
||||
step = -step;
|
||||
|
||||
double curr_value = DoubleValueFromString( EDA_UNITS::DEGREES, textCtrl->GetValue() ) / 10.0;
|
||||
double curr_value = DoubleValueFromString( EDA_UNITS::DEGREES, textCtrl->GetValue() );
|
||||
|
||||
curr_value += step;
|
||||
curr_value = std::max( -MAX_ROTATION, curr_value );
|
||||
|
|
|
@ -78,7 +78,7 @@ double To_User_Unit( EDA_UNITS aUnit, double aValue )
|
|||
return IU_TO_IN( aValue );
|
||||
|
||||
case EDA_UNITS::DEGREES:
|
||||
return aValue / 10.0f;
|
||||
return aValue;
|
||||
|
||||
default:
|
||||
return aValue;
|
||||
|
@ -260,11 +260,8 @@ double From_User_Unit( EDA_UNITS aUnits, double aValue )
|
|||
case EDA_UNITS::INCHES:
|
||||
return IN_TO_IU( aValue );
|
||||
|
||||
case EDA_UNITS::DEGREES:
|
||||
// Convert to "decidegrees"
|
||||
return aValue * 10;
|
||||
|
||||
default:
|
||||
case EDA_UNITS::DEGREES:
|
||||
case EDA_UNITS::UNSCALED:
|
||||
case EDA_UNITS::PERCENT:
|
||||
return aValue;
|
||||
|
@ -329,9 +326,7 @@ double DoubleValueFromString( EDA_UNITS aUnits, const wxString& aTextValue, EDA_
|
|||
else if( aUnits == EDA_UNITS::DEGREES )
|
||||
{
|
||||
if( unit == wxT( "ra" ) ) // Radians
|
||||
{
|
||||
dtmp *= 180.0f / M_PI;
|
||||
}
|
||||
}
|
||||
|
||||
switch( aType )
|
||||
|
|
|
@ -109,27 +109,28 @@ void ARC_ASSISTANT::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const
|
|||
// draw the radius guide circle
|
||||
preview_ctx.DrawCircle( origin, m_constructMan.GetRadius(), true );
|
||||
|
||||
double degs = getNormDeciDegFromRad( initAngle );
|
||||
EDA_ANGLE angle( initAngle, RADIANS_T );
|
||||
angle.Normalize();
|
||||
|
||||
cursorStrings.push_back( DimensionLabel( "r", m_constructMan.GetRadius(), m_units ) );
|
||||
cursorStrings.push_back( DimensionLabel( wxString::FromUTF8( "θ" ), degs,
|
||||
cursorStrings.push_back( DimensionLabel( wxString::FromUTF8( "θ" ), angle.AsDegrees(),
|
||||
EDA_UNITS::DEGREES ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
preview_ctx.DrawLineWithAngleHighlight( origin, m_constructMan.GetEndRadiusEnd(), false );
|
||||
|
||||
double start = m_constructMan.GetStartAngle();
|
||||
double subtended = m_constructMan.GetSubtended();
|
||||
double subtendedDeg = getNormDeciDegFromRad( subtended );
|
||||
double endAngleDeg = getNormDeciDegFromRad( start + subtended );
|
||||
double start = m_constructMan.GetStartAngle();
|
||||
double subtended = m_constructMan.GetSubtended();
|
||||
EDA_ANGLE incAngle( subtended, RADIANS_T );
|
||||
EDA_ANGLE endAngle( start + subtended, RADIANS_T );
|
||||
|
||||
// draw dimmed extender line to cursor
|
||||
preview_ctx.DrawLineWithAngleHighlight( origin, m_constructMan.GetLastPoint(), true );
|
||||
|
||||
cursorStrings.push_back( DimensionLabel( wxString::FromUTF8( "Δθ" ), subtendedDeg,
|
||||
cursorStrings.push_back( DimensionLabel( wxString::FromUTF8( "Δθ" ), incAngle.AsDegrees(),
|
||||
EDA_UNITS::DEGREES ) );
|
||||
cursorStrings.push_back( DimensionLabel( wxString::FromUTF8( "θ" ), endAngleDeg,
|
||||
cursorStrings.push_back( DimensionLabel( wxString::FromUTF8( "θ" ), endAngle.AsDegrees(),
|
||||
EDA_UNITS::DEGREES ) );
|
||||
}
|
||||
|
||||
|
|
|
@ -72,8 +72,8 @@ static void drawCursorStrings( KIGFX::VIEW* aView, const VECTOR2D& aCursor,
|
|||
|
||||
cursorStrings.push_back( DimensionLabel( "r", aRulerVec.EuclideanNorm(), aUnits ) );
|
||||
|
||||
double degs = RAD2DECIDEG( -aRulerVec.Angle() );
|
||||
cursorStrings.push_back( DimensionLabel( wxString::FromUTF8( "θ" ), degs,
|
||||
EDA_ANGLE angle( -aRulerVec.Angle(), RADIANS_T );
|
||||
cursorStrings.push_back( DimensionLabel( wxString::FromUTF8( "θ" ), angle.AsDegrees(),
|
||||
EDA_UNITS::DEGREES ) );
|
||||
|
||||
temp = aRulerVec;
|
||||
|
|
|
@ -276,10 +276,7 @@ void UNIT_BINDER::SetDoubleValue( double aValue )
|
|||
|
||||
void UNIT_BINDER::SetAngleValue( const EDA_ANGLE& aValue )
|
||||
{
|
||||
if( m_units == EDA_UNITS::DEGREES )
|
||||
SetDoubleValue( aValue.AsTenthsOfADegree() ); // Historical reasons.
|
||||
else
|
||||
SetDoubleValue( aValue.AsDegrees() );
|
||||
SetDoubleValue( aValue.AsDegrees() );
|
||||
}
|
||||
|
||||
|
||||
|
@ -327,10 +324,7 @@ void UNIT_BINDER::ChangeDoubleValue( double aValue )
|
|||
|
||||
void UNIT_BINDER::ChangeAngleValue( const EDA_ANGLE& aValue )
|
||||
{
|
||||
if( m_units == EDA_UNITS::DEGREES )
|
||||
ChangeDoubleValue( aValue.AsTenthsOfADegree() ); // Historical reasons.
|
||||
else
|
||||
ChangeDoubleValue( aValue.AsDegrees() );
|
||||
ChangeDoubleValue( aValue.AsDegrees() );
|
||||
}
|
||||
|
||||
|
||||
|
@ -426,10 +420,7 @@ double UNIT_BINDER::GetDoubleValue()
|
|||
|
||||
EDA_ANGLE UNIT_BINDER::GetAngleValue()
|
||||
{
|
||||
if( m_units == EDA_UNITS::DEGREES )
|
||||
return EDA_ANGLE( GetDoubleValue(), TENTHS_OF_A_DEGREE_T ); // historical reasons
|
||||
else
|
||||
return EDA_ANGLE( GetDoubleValue(), DEGREES_T );
|
||||
return EDA_ANGLE( GetDoubleValue(), DEGREES_T );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -75,6 +75,11 @@ void WIDGET_SAVE_RESTORE::Add( UNIT_BINDER& ctrl, long& dest )
|
|||
}
|
||||
|
||||
|
||||
void WIDGET_SAVE_RESTORE::Add( UNIT_BINDER& ctrl, EDA_ANGLE& dest )
|
||||
{
|
||||
m_ctrls.emplace_back( WIDGET_CTRL_TYPE_T::UNIT_BINDER_ANGLE, ctrl, dest );
|
||||
}
|
||||
|
||||
void WIDGET_SAVE_RESTORE::Add( wxChoice& ctrl, long& dest )
|
||||
{
|
||||
m_ctrls.emplace_back( WIDGET_CTRL_TYPE_T::CHOICE, ctrl, dest );
|
||||
|
@ -117,6 +122,10 @@ void WIDGET_SAVE_RESTORE::ReadConfigFromControls()
|
|||
*ctrl.m_dest.m_long = ctrl.m_control.m_unit_binder->GetValue();
|
||||
break;
|
||||
|
||||
case WIDGET_CTRL_TYPE_T::UNIT_BINDER_ANGLE:
|
||||
*ctrl.m_dest.m_angle = ctrl.m_control.m_unit_binder->GetAngleValue();
|
||||
break;
|
||||
|
||||
case WIDGET_CTRL_TYPE_T::CHOICE:
|
||||
*ctrl.m_dest.m_long = ctrl.m_control.m_choice->GetSelection();
|
||||
break;
|
||||
|
@ -168,6 +177,10 @@ void WIDGET_SAVE_RESTORE::RestoreConfigToControls()
|
|||
ctrl.m_control.m_unit_binder->SetValue( *ctrl.m_dest.m_long );
|
||||
break;
|
||||
|
||||
case WIDGET_CTRL_TYPE_T::UNIT_BINDER_ANGLE:
|
||||
ctrl.m_control.m_unit_binder->SetAngleValue( *ctrl.m_dest.m_angle );
|
||||
break;
|
||||
|
||||
case WIDGET_CTRL_TYPE_T::CHOICE:
|
||||
ctrl.m_control.m_choice->SetSelection( *ctrl.m_dest.m_long );
|
||||
break;
|
||||
|
|
|
@ -886,14 +886,13 @@ void GERBVIEW_FRAME::UpdateStatusBar()
|
|||
|
||||
if( GetShowPolarCoords() ) // display relative polar coordinates
|
||||
{
|
||||
double dx = cursorPos.x - GetScreen()->m_LocalOrigin.x;
|
||||
double dy = cursorPos.y - GetScreen()->m_LocalOrigin.y;
|
||||
double theta = RAD2DEG( atan2( -dy, dx ) );
|
||||
double ro = hypot( dx, dy );
|
||||
VECTOR2D v = cursorPos - GetScreen()->m_LocalOrigin;
|
||||
EDA_ANGLE theta( VECTOR2D( v.x, -v.y ) );
|
||||
double ro = hypot( v.x, v.y );
|
||||
|
||||
line.Printf( wxT( "r %s theta %s" ),
|
||||
MessageTextFromValue( GetUserUnits(), ro, false ),
|
||||
MessageTextFromValue( EDA_UNITS::DEGREES, theta, false ) );
|
||||
MessageTextFromValue( EDA_UNITS::DEGREES, theta.AsDegrees(), false ) );
|
||||
|
||||
SetStatusText( line, 3 );
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@ class wxString;
|
|||
class wxTextCtrl;
|
||||
|
||||
class UNIT_BINDER;
|
||||
class EDA_ANGLE;
|
||||
|
||||
class WIDGET_SAVE_RESTORE
|
||||
{
|
||||
|
@ -82,6 +83,11 @@ public:
|
|||
*/
|
||||
void Add( UNIT_BINDER& ctrl, long& dest );
|
||||
|
||||
/**
|
||||
* Bind a control managed by a #UNIT_BINDER into an angle
|
||||
*/
|
||||
void Add( UNIT_BINDER& ctrl, EDA_ANGLE& dest );
|
||||
|
||||
/**
|
||||
* Bind a choice control into a choice (agnostic to the actual
|
||||
* meaning of the choice)
|
||||
|
@ -116,6 +122,7 @@ private:
|
|||
TEXT_INTEGER,
|
||||
TEXT_DOUBLE,
|
||||
UNIT_BINDER,
|
||||
UNIT_BINDER_ANGLE,
|
||||
CHECKBOX,
|
||||
RADIOBUTTON,
|
||||
RADIOBOX,
|
||||
|
@ -189,10 +196,16 @@ private:
|
|||
{
|
||||
}
|
||||
|
||||
long* m_long;
|
||||
bool* m_bool;
|
||||
wxString* m_str;
|
||||
double* m_double;
|
||||
DATA( EDA_ANGLE* aDest ) :
|
||||
m_angle( aDest )
|
||||
{
|
||||
}
|
||||
|
||||
long* m_long;
|
||||
bool* m_bool;
|
||||
wxString* m_str;
|
||||
double* m_double;
|
||||
EDA_ANGLE* m_angle;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -270,7 +270,7 @@ bool DIALOG_COPPER_ZONE::TransferDataToWindow()
|
|||
}
|
||||
|
||||
m_gridStyleRotation.SetUnits( EDA_UNITS::DEGREES );
|
||||
m_gridStyleRotation.SetValue( m_settings.m_HatchOrientation * 10 ); // IU is decidegree
|
||||
m_gridStyleRotation.SetAngleValue( EDA_ANGLE( m_settings.m_HatchOrientation, DEGREES_T ) );
|
||||
|
||||
// Gives a reasonable value to grid style parameters, if currently there are no defined
|
||||
// parameters for grid pattern thickness and gap (if the value is 0)
|
||||
|
@ -419,7 +419,7 @@ bool DIALOG_COPPER_ZONE::TransferDataFromWindow()
|
|||
if( !AcceptOptions() )
|
||||
return false;
|
||||
|
||||
m_settings.m_HatchOrientation = m_gridStyleRotation.GetValue() / 10.0; // value is returned in deci-degree
|
||||
m_settings.m_HatchOrientation = m_gridStyleRotation.GetAngleValue().AsDegrees();
|
||||
m_settings.m_HatchThickness = m_gridStyleThickness.GetValue();
|
||||
m_settings.m_HatchGap = m_gridStyleGap.GetValue();
|
||||
m_settings.m_HatchSmoothingLevel = m_spinCtrlSmoothLevel->GetValue();
|
||||
|
|
|
@ -63,7 +63,6 @@ struct CREATE_ARRAY_DIALOG_ENTRIES
|
|||
m_GridSecondaryAxisStep( 1 ),
|
||||
m_CircCentreX( 0 ),
|
||||
m_CircCentreY( 0 ),
|
||||
m_CircAngle( 0.0 ),
|
||||
m_CircCount( 4 ),
|
||||
m_CircNumStartSet( 1 ), // use specified start
|
||||
m_GridCircNumScheme( 0 ),
|
||||
|
@ -76,40 +75,40 @@ struct CREATE_ARRAY_DIALOG_ENTRIES
|
|||
{
|
||||
}
|
||||
|
||||
bool m_OptionsSet;
|
||||
bool m_OptionsSet;
|
||||
|
||||
long m_GridNx;
|
||||
long m_GridNy;
|
||||
long m_GridDx;
|
||||
long m_GridDy;
|
||||
long m_GridOffsetX;
|
||||
long m_GridOffsetY;
|
||||
long m_GridStagger;
|
||||
long m_GridNx;
|
||||
long m_GridNy;
|
||||
long m_GridDx;
|
||||
long m_GridDy;
|
||||
long m_GridOffsetX;
|
||||
long m_GridOffsetY;
|
||||
long m_GridStagger;
|
||||
|
||||
long m_GridStaggerType;
|
||||
long m_GridNumberingAxis;
|
||||
bool m_GridNumReverseAlt;
|
||||
long m_GridNumStartSet;
|
||||
long m_Grid2dArrayNumbering;
|
||||
long m_GridPrimaryAxisScheme;
|
||||
long m_GridSecondaryAxisScheme;
|
||||
wxString m_GridPrimaryNumOffset;
|
||||
wxString m_GridSecondaryNumOffset;
|
||||
long m_GridPrimaryAxisStep;
|
||||
long m_GridSecondaryAxisStep;
|
||||
long m_GridStaggerType;
|
||||
long m_GridNumberingAxis;
|
||||
bool m_GridNumReverseAlt;
|
||||
long m_GridNumStartSet;
|
||||
long m_Grid2dArrayNumbering;
|
||||
long m_GridPrimaryAxisScheme;
|
||||
long m_GridSecondaryAxisScheme;
|
||||
wxString m_GridPrimaryNumOffset;
|
||||
wxString m_GridSecondaryNumOffset;
|
||||
long m_GridPrimaryAxisStep;
|
||||
long m_GridSecondaryAxisStep;
|
||||
|
||||
long m_CircCentreX;
|
||||
long m_CircCentreY;
|
||||
long m_CircAngle;
|
||||
long m_CircCount;
|
||||
long m_CircNumStartSet;
|
||||
long m_GridCircNumScheme;
|
||||
wxString m_CircNumberingOffset;
|
||||
long m_CircNumberingStep;
|
||||
bool m_CircRotatationStep;
|
||||
long m_ArrayTypeTab;
|
||||
bool m_FootprintKeepAnnotations;
|
||||
bool m_FootprintReannotate;
|
||||
long m_CircCentreX;
|
||||
long m_CircCentreY;
|
||||
EDA_ANGLE m_CircAngle;
|
||||
long m_CircCount;
|
||||
long m_CircNumStartSet;
|
||||
long m_GridCircNumScheme;
|
||||
wxString m_CircNumberingOffset;
|
||||
long m_CircNumberingStep;
|
||||
bool m_CircRotatationStep;
|
||||
long m_ArrayTypeTab;
|
||||
bool m_FootprintKeepAnnotations;
|
||||
bool m_FootprintReannotate;
|
||||
};
|
||||
|
||||
// Persistent options settings
|
||||
|
|
|
@ -45,8 +45,7 @@ DIALOG_MOVE_EXACT::DIALOG_MOVE_EXACT( PCB_BASE_FRAME *aParent, VECTOR2I& aTransl
|
|||
m_rotate( aParent, m_rotLabel, m_rotEntry, m_rotUnit ),
|
||||
m_stateX( 0.0 ),
|
||||
m_stateY( 0.0 ),
|
||||
m_stateRadius( 0.0 ),
|
||||
m_stateTheta( 0.0 )
|
||||
m_stateRadius( 0.0 )
|
||||
{
|
||||
// We can't set the tab order through wxWidgets due to shortcomings in their mnemonics
|
||||
// implementation on MSW
|
||||
|
@ -115,12 +114,12 @@ void DIALOG_MOVE_EXACT::buildRotationAnchorMenu()
|
|||
}
|
||||
|
||||
|
||||
void DIALOG_MOVE_EXACT::ToPolarDeg( double x, double y, double& r, double& q )
|
||||
void DIALOG_MOVE_EXACT::ToPolarDeg( double x, double y, double& r, EDA_ANGLE& q )
|
||||
{
|
||||
// convert to polar coordinates
|
||||
r = hypot( x, y );
|
||||
|
||||
q = ( r != 0) ? RAD2DEG( atan2( y, x ) ) : 0;
|
||||
q = ( r != 0) ? EDA_ANGLE( VECTOR2D( x, y ) ) : ANGLE_0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -128,11 +127,11 @@ bool DIALOG_MOVE_EXACT::GetTranslationInIU( wxRealPoint& val, bool polar )
|
|||
{
|
||||
if( polar )
|
||||
{
|
||||
const double r = m_moveX.GetDoubleValue();
|
||||
const double q = m_moveY.GetDoubleValue();
|
||||
const double r = m_moveX.GetDoubleValue();
|
||||
const EDA_ANGLE q = m_moveY.GetAngleValue();
|
||||
|
||||
val.x = r * cos( DEG2RAD( q / 10.0 ) );
|
||||
val.y = r * sin( DEG2RAD( q / 10.0 ) );
|
||||
val.x = r * q.Cos();
|
||||
val.y = r * q.Sin();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -160,27 +159,26 @@ void DIALOG_MOVE_EXACT::OnPolarChanged( wxCommandEvent& event )
|
|||
m_stateX = moveX;
|
||||
m_stateY = moveY;
|
||||
ToPolarDeg( m_stateX, m_stateY, m_stateRadius, m_stateTheta );
|
||||
m_stateTheta *= 10.0;
|
||||
|
||||
m_moveX.SetDoubleValue( m_stateRadius );
|
||||
m_stateRadius = m_moveX.GetDoubleValue();
|
||||
m_moveY.SetDoubleValue( m_stateTheta );
|
||||
m_stateTheta = m_moveY.GetDoubleValue();
|
||||
m_moveY.SetAngleValue( m_stateTheta );
|
||||
m_stateTheta = m_moveY.GetAngleValue();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_moveX.SetDoubleValue( m_stateRadius );
|
||||
m_moveY.SetDoubleValue( m_stateTheta );
|
||||
m_moveY.SetAngleValue( m_stateTheta );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( moveX != m_stateRadius || moveY != m_stateTheta )
|
||||
if( moveX != m_stateRadius || moveY != m_stateTheta.AsDegrees() )
|
||||
{
|
||||
m_stateRadius = moveX;
|
||||
m_stateTheta = moveY;
|
||||
m_stateX = m_stateRadius * cos( DEG2RAD( m_stateTheta / 10.0 ) );
|
||||
m_stateY = m_stateRadius * sin( DEG2RAD( m_stateTheta / 10.0 ) );
|
||||
m_stateTheta = EDA_ANGLE( moveY, DEGREES_T );
|
||||
m_stateX = m_stateRadius * m_stateTheta.Cos();
|
||||
m_stateY = m_stateRadius * m_stateTheta.Sin();
|
||||
|
||||
m_moveX.SetDoubleValue( m_stateX );
|
||||
m_stateX = m_moveX.GetDoubleValue();
|
||||
|
@ -229,7 +227,7 @@ void DIALOG_MOVE_EXACT::OnClear( wxCommandEvent& event )
|
|||
}
|
||||
else if( obj == m_clearRot )
|
||||
{
|
||||
m_rotate.SetValue( 0 );
|
||||
m_rotate.SetAngleValue( ANGLE_0 );
|
||||
}
|
||||
|
||||
// Keep m_stdButtonsOK focused to allow enter key actiavte the OK button
|
||||
|
|
|
@ -67,10 +67,9 @@ private:
|
|||
/**
|
||||
* Convert a given Cartesian point into a polar representation.
|
||||
*
|
||||
* Linear units are not considered, the answer is in the same units as given
|
||||
* Angle is returned in degrees
|
||||
* Linear units are not considered, the answer is in the same units as given.
|
||||
*/
|
||||
void ToPolarDeg( double x, double y, double& r, double& q );
|
||||
void ToPolarDeg( double x, double y, double& r, EDA_ANGLE& q );
|
||||
|
||||
/**
|
||||
* Get the (Cartesian) translation described by the text entries.
|
||||
|
@ -111,21 +110,21 @@ private:
|
|||
static MOVE_EXACT_OPTIONS m_options;
|
||||
|
||||
private:
|
||||
VECTOR2I& m_translation;
|
||||
EDA_ANGLE& m_rotation;
|
||||
ROTATION_ANCHOR& m_rotationAnchor;
|
||||
const EDA_RECT& m_bbox;
|
||||
VECTOR2I& m_translation;
|
||||
EDA_ANGLE& m_rotation;
|
||||
ROTATION_ANCHOR& m_rotationAnchor;
|
||||
const EDA_RECT& m_bbox;
|
||||
|
||||
UNIT_BINDER m_moveX;
|
||||
UNIT_BINDER m_moveY;
|
||||
UNIT_BINDER m_rotate;
|
||||
UNIT_BINDER m_moveX;
|
||||
UNIT_BINDER m_moveY;
|
||||
UNIT_BINDER m_rotate;
|
||||
|
||||
std::vector<ROTATION_ANCHOR> m_menuIDs;
|
||||
|
||||
double m_stateX;
|
||||
double m_stateY;
|
||||
double m_stateRadius;
|
||||
double m_stateTheta;
|
||||
double m_stateX;
|
||||
double m_stateY;
|
||||
double m_stateRadius;
|
||||
EDA_ANGLE m_stateTheta;
|
||||
};
|
||||
|
||||
#endif // __DIALOG_MOVE_EXACT__
|
||||
|
|
|
@ -130,7 +130,7 @@ bool DIALOG_NON_COPPER_ZONES_EDITOR::TransferDataToWindow()
|
|||
}
|
||||
|
||||
m_hatchRotation.SetUnits( EDA_UNITS::DEGREES );
|
||||
m_hatchRotation.SetValue( m_settings.m_HatchOrientation * 10 ); // IU is decidegree
|
||||
m_hatchRotation.SetAngleValue( EDA_ANGLE( m_settings.m_HatchOrientation, DEGREES_T ) );
|
||||
|
||||
// Gives a reasonable value to grid style parameters, if currently there are no defined
|
||||
// parameters for grid pattern thickness and gap (if the value is 0)
|
||||
|
@ -197,9 +197,6 @@ bool DIALOG_NON_COPPER_ZONES_EDITOR::TransferDataFromWindow()
|
|||
m_settings.SetCornerRadius( m_settings.GetCornerSmoothingType() == ZONE_SETTINGS::SMOOTHING_NONE
|
||||
? 0 : m_cornerRadius.GetValue() );
|
||||
|
||||
if( !m_hatchRotation.Validate( -1800, 1800 ) )
|
||||
return false;
|
||||
|
||||
m_settings.m_ZoneMinThickness = m_minWidth.GetValue();
|
||||
|
||||
switch( m_OutlineDisplayCtrl->GetSelection() )
|
||||
|
@ -227,7 +224,7 @@ bool DIALOG_NON_COPPER_ZONES_EDITOR::TransferDataFromWindow()
|
|||
}
|
||||
|
||||
|
||||
m_settings.m_HatchOrientation = m_hatchRotation.GetValue() / 10.0; // value is returned in deci-degree
|
||||
m_settings.m_HatchOrientation = m_hatchRotation.GetAngleValue().AsDegrees();
|
||||
m_settings.m_HatchThickness = m_hatchWidth.GetValue();
|
||||
m_settings.m_HatchGap = m_hatchGap.GetValue();
|
||||
m_settings.m_HatchSmoothingLevel = m_spinCtrlSmoothLevel->GetValue();
|
||||
|
|
|
@ -196,6 +196,7 @@ DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES( PCB_BASE_FRAME* aParent, PAD* aPad
|
|||
m_pad_orientation.SetPrecision( 3 );
|
||||
|
||||
m_spokeAngle.SetUnits( EDA_UNITS::DEGREES );
|
||||
m_spokeAngle.SetPrecision( 3 );
|
||||
|
||||
m_pasteMargin.SetNegativeZero();
|
||||
|
||||
|
@ -858,13 +859,13 @@ void DIALOG_PAD_PROPERTIES::OnPadShapeSelection( wxCommandEvent& event )
|
|||
// what the last shape was.
|
||||
if( m_PadShapeSelector->GetSelection() == CHOICE_SHAPE_CIRCLE )
|
||||
{
|
||||
if( m_sizeYCtrl->IsEnabled() && m_spokeAngle.GetDoubleValue() == 900.0 )
|
||||
m_spokeAngle.SetDoubleValue( 450.0 );
|
||||
if( m_sizeYCtrl->IsEnabled() && m_spokeAngle.GetAngleValue() == ANGLE_90 )
|
||||
m_spokeAngle.SetAngleValue( ANGLE_45 );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( !m_sizeYCtrl->IsEnabled() && m_spokeAngle.GetDoubleValue() == 450.0 )
|
||||
m_spokeAngle.SetDoubleValue( 900.0 );
|
||||
if( !m_sizeYCtrl->IsEnabled() && m_spokeAngle.GetAngleValue() == ANGLE_45 )
|
||||
m_spokeAngle.SetAngleValue( ANGLE_90 );
|
||||
}
|
||||
|
||||
// Readjust props book size
|
||||
|
|
|
@ -43,8 +43,7 @@ DIALOG_POSITION_RELATIVE::DIALOG_POSITION_RELATIVE( PCB_BASE_FRAME* aParent, VEC
|
|||
m_yOffset( aParent, m_yLabel, m_yEntry, m_yUnit ),
|
||||
m_stateX( 0.0 ),
|
||||
m_stateY( 0.0 ),
|
||||
m_stateRadius( 0.0 ),
|
||||
m_stateTheta( 0.0 )
|
||||
m_stateRadius( 0.0 )
|
||||
{
|
||||
// We can't set the tab order through wxWidgets due to shortcomings in their mnemonics
|
||||
// implementation on MSW
|
||||
|
@ -74,12 +73,12 @@ DIALOG_POSITION_RELATIVE::DIALOG_POSITION_RELATIVE( PCB_BASE_FRAME* aParent, VEC
|
|||
}
|
||||
|
||||
|
||||
void DIALOG_POSITION_RELATIVE::ToPolarDeg( double x, double y, double& r, double& q )
|
||||
void DIALOG_POSITION_RELATIVE::ToPolarDeg( double x, double y, double& r, EDA_ANGLE& q )
|
||||
{
|
||||
// convert to polar coordinates
|
||||
r = hypot( x, y );
|
||||
|
||||
q = ( r != 0) ? RAD2DEG( atan2( y, x ) ) : 0;
|
||||
q = ( r != 0) ? EDA_ANGLE( VECTOR2D( x, y ) ) : ANGLE_0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -87,11 +86,11 @@ bool DIALOG_POSITION_RELATIVE::GetTranslationInIU( wxRealPoint& val, bool polar
|
|||
{
|
||||
if( polar )
|
||||
{
|
||||
const double r = m_xOffset.GetDoubleValue();
|
||||
const double q = m_yOffset.GetDoubleValue();
|
||||
const double r = m_xOffset.GetDoubleValue();
|
||||
const EDA_ANGLE q = m_yOffset.GetAngleValue();
|
||||
|
||||
val.x = r * cos( DEG2RAD( q / 10.0 ) );
|
||||
val.y = r * sin( DEG2RAD( q / 10.0 ) );
|
||||
val.x = r * q.Cos();
|
||||
val.y = r * q.Sin();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -119,27 +118,26 @@ void DIALOG_POSITION_RELATIVE::OnPolarChanged( wxCommandEvent& event )
|
|||
m_stateX = xOffset;
|
||||
m_stateY = yOffset;
|
||||
ToPolarDeg( m_stateX, m_stateY, m_stateRadius, m_stateTheta );
|
||||
m_stateTheta *= 10.0;
|
||||
|
||||
m_xOffset.SetDoubleValue( m_stateRadius );
|
||||
m_stateRadius = m_xOffset.GetDoubleValue();
|
||||
m_yOffset.SetDoubleValue( m_stateTheta );
|
||||
m_stateTheta = m_yOffset.GetDoubleValue();
|
||||
m_yOffset.SetAngleValue( m_stateTheta );
|
||||
m_stateTheta = m_yOffset.GetAngleValue();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_xOffset.SetDoubleValue( m_stateRadius );
|
||||
m_yOffset.SetDoubleValue( m_stateTheta );
|
||||
m_yOffset.SetAngleValue( m_stateTheta );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( xOffset != m_stateRadius || yOffset != m_stateTheta )
|
||||
if( xOffset != m_stateRadius || yOffset != m_stateTheta.AsDegrees() )
|
||||
{
|
||||
m_stateRadius = xOffset;
|
||||
m_stateTheta = yOffset;
|
||||
m_stateX = m_stateRadius * cos( DEG2RAD( m_stateTheta / 10.0 ) );
|
||||
m_stateY = m_stateRadius * sin( DEG2RAD( m_stateTheta / 10.0 ) );
|
||||
m_stateTheta = EDA_ANGLE( yOffset, DEGREES_T );
|
||||
m_stateX = m_stateRadius * m_stateTheta.Cos();
|
||||
m_stateY = m_stateRadius * m_stateTheta.Sin();
|
||||
|
||||
m_xOffset.SetDoubleValue( m_stateX );
|
||||
m_stateX = m_xOffset.GetDoubleValue();
|
||||
|
@ -182,8 +180,9 @@ void DIALOG_POSITION_RELATIVE::OnClear( wxCommandEvent& event )
|
|||
POSITION_RELATIVE_TOOL* posrelTool = m_toolMgr->GetTool<POSITION_RELATIVE_TOOL>();
|
||||
wxASSERT( posrelTool );
|
||||
|
||||
VECTOR2I offset = posrelTool->GetSelectionAnchorPosition() - m_anchor_position;
|
||||
double r, q;
|
||||
VECTOR2I offset = posrelTool->GetSelectionAnchorPosition() - m_anchor_position;
|
||||
double r;
|
||||
EDA_ANGLE q;
|
||||
ToPolarDeg( offset.x, offset.y, r, q );
|
||||
|
||||
|
||||
|
@ -194,28 +193,20 @@ void DIALOG_POSITION_RELATIVE::OnClear( wxCommandEvent& event )
|
|||
m_stateRadius = m_xOffset.GetDoubleValue();
|
||||
|
||||
if( m_polarCoords->IsChecked() )
|
||||
{
|
||||
m_xOffset.SetDoubleValue( m_stateRadius );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_xOffset.SetValue( m_stateX );
|
||||
}
|
||||
}
|
||||
else if( obj == m_clearY )
|
||||
{
|
||||
m_stateY = offset.y;
|
||||
m_yOffset.SetDoubleValue( q * 10 );
|
||||
m_stateTheta = m_yOffset.GetDoubleValue();
|
||||
m_yOffset.SetAngleValue( q );
|
||||
m_stateTheta = m_yOffset.GetAngleValue();
|
||||
|
||||
if( m_polarCoords->IsChecked() )
|
||||
{
|
||||
m_yOffset.SetDoubleValue( m_stateTheta );
|
||||
}
|
||||
m_yOffset.SetAngleValue( m_stateTheta );
|
||||
else
|
||||
{
|
||||
m_yOffset.SetValue( m_stateY );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -58,10 +58,9 @@ private:
|
|||
/**
|
||||
* Convert a given Cartesian point into a polar representation.
|
||||
*
|
||||
* Linear units are not considered, the answer is in the same units as given
|
||||
* Angle is returned in degrees
|
||||
* Linear units are not considered, the answer is in the same units as given.
|
||||
*/
|
||||
void ToPolarDeg( double x, double y, double& r, double& q );
|
||||
void ToPolarDeg( double x, double y, double& r, EDA_ANGLE& q );
|
||||
|
||||
/**
|
||||
* Get the (Cartesian) translation described by the text entries.
|
||||
|
@ -102,10 +101,10 @@ private:
|
|||
UNIT_BINDER m_xOffset;
|
||||
UNIT_BINDER m_yOffset;
|
||||
|
||||
double m_stateX;
|
||||
double m_stateY;
|
||||
double m_stateRadius;
|
||||
double m_stateTheta;
|
||||
double m_stateX;
|
||||
double m_stateY;
|
||||
double m_stateRadius;
|
||||
EDA_ANGLE m_stateTheta;
|
||||
};
|
||||
|
||||
#endif // __DIALOG_POSITION_RELATIVE__
|
||||
|
|
|
@ -211,9 +211,7 @@ wxString FP_TEXT_GRID_TABLE::GetValue( int aRow, int aCol )
|
|||
return text.GetLayerName();
|
||||
|
||||
case FPT_ORIENTATION:
|
||||
return StringFromValue( EDA_UNITS::DEGREES,
|
||||
NormalizeAnglePos( text.GetTextAngle().AsTenthsOfADegree() ),
|
||||
true );
|
||||
return StringFromValue( EDA_UNITS::DEGREES, text.GetTextAngle().AsDegrees(), true );
|
||||
|
||||
case FPT_XOFFSET:
|
||||
return StringFromValue( m_frame->GetUserUnits(), text.GetPos0().x, true );
|
||||
|
|
Loading…
Reference in New Issue