From: Florian BRUNET Date: Mon, 11 Aug 2014 13:53:38 +0000 (+0200) Subject: Addition of a specific error message for the 0 and 360 values. X-Git-Tag: V7_5_0a1~30^2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2Ffbt%2FaddAngleInCylPrimitive;p=modules%2Fgeom.git Addition of a specific error message for the 0 and 360 values. --- diff --git a/src/GEOMGUI/GEOM_msg_en.ts b/src/GEOMGUI/GEOM_msg_en.ts index 04e9f9d6b..c8a36982d 100644 --- a/src/GEOMGUI/GEOM_msg_en.ts +++ b/src/GEOMGUI/GEOM_msg_en.ts @@ -535,6 +535,10 @@ Please, select face, shell or solid and try again GEOM_CYLINDER_TITLE Cylinder Construction + + GEOM_CYLINDER_ANGLE_ERR + Angle values 0 and 360 are unsafe to build proper volumes. Please uncheck the "Angle" box to use the regular cylinder constructor. + GEOM_D1 D1 : diff --git a/src/GEOMGUI/GEOM_msg_fr.ts b/src/GEOMGUI/GEOM_msg_fr.ts index 20d5ebe4e..af43089e2 100644 --- a/src/GEOMGUI/GEOM_msg_fr.ts +++ b/src/GEOMGUI/GEOM_msg_fr.ts @@ -547,6 +547,10 @@ Choisissez une face, une coque ou un solide et essayez de nouveau GEOM_CYLINDER_TITLE Construction d'un cylindre + + GEOM_CYLINDER_ANGLE_ERR + 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. + GEOM_D1 D1 : diff --git a/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx index 9f9ad7a6c..73e7c03fa 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx @@ -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;