Addition of a specific error message for the 0 and 360 values.

This commit is contained in:
Florian BRUNET 2014-08-11 15:53:38 +02:00
parent b9cd395cc3
commit 7ac599fe97
3 changed files with 24 additions and 4 deletions

View File

@ -535,6 +535,10 @@ Please, select face, shell or solid and try again</translation>
<source>GEOM_CYLINDER_TITLE</source>
<translation>Cylinder Construction</translation>
</message>
<message>
<source>GEOM_CYLINDER_ANGLE_ERR</source>
<translation>Angle values 0 and 360 are unsafe to build proper volumes. Please uncheck the "Angle" box to use the regular cylinder constructor.</translation>
</message>
<message>
<source>GEOM_D1</source>
<translation>D1 :</translation>

View File

@ -547,6 +547,10 @@ Choisissez une face, une coque ou un solide et essayez de nouveau</translation>
<source>GEOM_CYLINDER_TITLE</source>
<translation>Construction d&apos;un cylindre </translation>
</message>
<message>
<source>GEOM_CYLINDER_ANGLE_ERR</source>
<translation>Les valeurs de l'angle 0 et 360 sont à éviter pour construire des volumes sains. Veuillez décocher la case "Angle" pour utiliser le constructeur de cylindre complet.</translation>
</message>
<message>
<source>GEOM_D1</source>
<translation>D1 :</translation>

View File

@ -124,11 +124,11 @@ void PrimitiveGUI_CylinderDlg::Init()
double SpecificStep = 5;
initSpinBox(GroupPoints->SpinBox_DX, 0.00001, COORD_MAX, step, "length_precision" );
initSpinBox(GroupPoints->SpinBox_DY, 0.00001, COORD_MAX, step, "length_precision" );
initSpinBox(GroupPoints->SpinBox_DZ, 0.00001, 359.99999, SpecificStep, "angle_precision" );
initSpinBox(GroupPoints->SpinBox_DZ, 0., 360., SpecificStep, "angle_precision" );
initSpinBox(GroupDimensions->SpinBox_DX, 0.00001, COORD_MAX, step, "length_precision" );
initSpinBox(GroupDimensions->SpinBox_DY, 0.00001, COORD_MAX, step, "length_precision" );
initSpinBox(GroupDimensions->SpinBox_DZ, 0.00001, 359.99999, SpecificStep, "angle_precision" );
initSpinBox(GroupDimensions->SpinBox_DZ, 0., 360., SpecificStep, "angle_precision" );
// init variables
myEditCurrentArgument = GroupPoints->LineEdit1;
@ -218,7 +218,7 @@ void PrimitiveGUI_CylinderDlg::ConstructorsClicked (int constructorId)
updateGeometry();
resize(minimumSizeHint());
SelectionIntoArgument();
displayPreview(true);
}
@ -298,7 +298,6 @@ void PrimitiveGUI_CylinderDlg::SelectionIntoArgument()
this, SLOT(SelectionIntoArgument()));
}
}
displayPreview(true);
}
@ -372,6 +371,11 @@ void PrimitiveGUI_CylinderDlg::enterEvent (QEvent*)
//=================================================================================
void PrimitiveGUI_CylinderDlg::ValueChangedInSpinBox()
{
QString msg;
if (!isValid(msg)) {
erasePreview();
return;
}
displayPreview(true);
}
@ -397,12 +401,20 @@ bool PrimitiveGUI_CylinderDlg::isValid (QString& msg)
GroupPoints->SpinBox_DY->isValid( msg, !IsPreview() ) &&
GroupPoints->SpinBox_DZ->isValid( msg, !IsPreview() ) &&
myPoint && myDir;
if(GroupPoints->SpinBox_DZ->value()<=0. || GroupPoints->SpinBox_DZ->value()>=360.) {
msg += tr("GEOM_CYLINDER_ANGLE_ERR") + "\n";
ok = false;
}
}
else if( getConstructorId() == 1 )
{
ok = GroupDimensions->SpinBox_DX->isValid( msg, !IsPreview() ) &&
GroupDimensions->SpinBox_DY->isValid( msg, !IsPreview() ) &&
GroupDimensions->SpinBox_DZ->isValid( msg, !IsPreview() );
if(GroupDimensions->SpinBox_DZ->value()<=0. || GroupDimensions->SpinBox_DZ->value()>=360.) {
msg += tr("GEOM_CYLINDER_ANGLE_ERR") + "\n";
ok = false;
}
}
ok = qAbs( getHeight() ) > Precision::Confusion() && ok;
ok = qAbs( getRadius() ) > Precision::Confusion() && ok;