mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-02-15 23:33:07 +05:00
rnc:
Small bug fix : the minimum allowed radius when building an arc by end point and radius, was badly computed in case of "absolute" construction mode.
This commit is contained in:
parent
5df76e0552
commit
54b95c0b35
@ -1503,8 +1503,8 @@ void EntityGUI_SketcherDlg::closeEvent( QCloseEvent* e )
|
||||
void EntityGUI_SketcherDlg::ValueChangedInSpinBox( double newValue )
|
||||
{
|
||||
QObject* send = (QObject*)sender();
|
||||
Standard_Real vx, vy, vz, vs, minRad;
|
||||
vx = vy = vz = vs = minRad =0.0;
|
||||
Standard_Real vx, vy, vz, vs, minRad, dx, dy;
|
||||
vx = vy = vz = vs = minRad = dx = dy = 0.0;
|
||||
|
||||
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
|
||||
int aPrecision = resMgr->integerValue( "Geometry", "length_precision", 6 );
|
||||
@ -1535,17 +1535,25 @@ void EntityGUI_SketcherDlg::ValueChangedInSpinBox( double newValue )
|
||||
vy = Group3Spin->SpinBox_DY->value(); vyStr = Group3Spin->SpinBox_DY->text();
|
||||
vz = Group3Spin->SpinBox_DZ->value();
|
||||
if ( (mySketchType == PT_REL_RADIUS || mySketchType == PT_ABS_RADIUS) && (vx != 0 || vy != 0) ) {
|
||||
minRad = 0.5 * Sqrt(vx * vx + vy * vy); //Computation of the minimum acceptable radius for the arc calculation
|
||||
if (mySketchType == PT_ABS_RADIUS){
|
||||
dx = vx - myLastX1;
|
||||
dy = vy - myLastY1;
|
||||
}
|
||||
else{
|
||||
dx = vx;
|
||||
dy = vy;
|
||||
}
|
||||
minRad = 0.5 * Sqrt(dx * dx + dy * dy); //Computation of the minimum acceptable radius for the arc calculation
|
||||
if (aPrecision >= 0) // 'f' format in the QString
|
||||
LastDecimal = aPrecision;
|
||||
LastDecimal = aPrecision;
|
||||
else // 'g' format in the Qstring
|
||||
LastDecimal = qAbs( aPrecision ) - ceil( log10(minRad) );
|
||||
LastDecimal = qAbs( aPrecision ) - ceil( log10(minRad) );
|
||||
minRad = ceil(pow(10,LastDecimal) * minRad) / pow(10,LastDecimal); // Rounded up at the last allowed decimal place
|
||||
if ( Abs(vz) < minRad){
|
||||
if (vz < 0.0)
|
||||
Group3Spin->SpinBox_DZ->setValue( - minRad );
|
||||
else
|
||||
Group3Spin->SpinBox_DZ->setValue( minRad );
|
||||
if (vz < 0.0)
|
||||
Group3Spin->SpinBox_DZ->setValue( - minRad );
|
||||
else
|
||||
Group3Spin->SpinBox_DZ->setValue( minRad );
|
||||
}
|
||||
}
|
||||
vz = Group3Spin->SpinBox_DZ->value(); vzStr = Group3Spin->SpinBox_DZ->text();
|
||||
@ -1555,17 +1563,25 @@ void EntityGUI_SketcherDlg::ValueChangedInSpinBox( double newValue )
|
||||
vy = newValue; vyStr = newValueStr;
|
||||
vz = Group3Spin->SpinBox_DZ->value(); vzStr = Group3Spin->SpinBox_DZ->text();
|
||||
if ( (mySketchType == PT_REL_RADIUS || mySketchType == PT_ABS_RADIUS) && (vx != 0 || vy != 0)){
|
||||
minRad = 0.5 * Sqrt(vx * vx + vy * vy); //Computation of the minimum acceptable radius for the arc calculation
|
||||
if (mySketchType == PT_ABS_RADIUS){
|
||||
dx = vx - myLastX1;
|
||||
dy = vy - myLastY1;
|
||||
}
|
||||
else{
|
||||
dx = vx;
|
||||
dy = vy;
|
||||
}
|
||||
minRad = 0.5 * Sqrt(dx * dx + dy * dy); //Computation of the minimum acceptable radius for the arc calculation
|
||||
if (aPrecision >= 0) // 'f' format in the QString
|
||||
LastDecimal = aPrecision;
|
||||
LastDecimal = aPrecision;
|
||||
else // 'g' format in the QString
|
||||
LastDecimal = qAbs( aPrecision ) - ceil( log10(minRad) );
|
||||
LastDecimal = qAbs( aPrecision ) - ceil( log10(minRad) );
|
||||
minRad = ceil(pow(10,LastDecimal) * minRad) / pow(10,LastDecimal); // Rounded up at the last allowed decimal place
|
||||
if ( Abs(vz) < minRad){
|
||||
if (vz < 0.0)
|
||||
Group3Spin->SpinBox_DZ->setValue( - minRad );
|
||||
else
|
||||
Group3Spin->SpinBox_DZ->setValue( minRad );
|
||||
if (vz < 0.0)
|
||||
Group3Spin->SpinBox_DZ->setValue( - minRad );
|
||||
else
|
||||
Group3Spin->SpinBox_DZ->setValue( minRad );
|
||||
}
|
||||
}
|
||||
vz = Group3Spin->SpinBox_DZ->value(); vzStr = Group3Spin->SpinBox_DZ->text();
|
||||
|
Loading…
Reference in New Issue
Block a user