Salome HOME
Addition of a specific error message for the 0 and 360 values. fbt/addAngleInCylPrimitive
authorFlorian BRUNET <FB15EB3N@dsp0657834.(none)>
Mon, 11 Aug 2014 13:53:38 +0000 (15:53 +0200)
committerFlorian BRUNET <FB15EB3N@dsp0657834.(none)>
Mon, 11 Aug 2014 13:53:38 +0000 (15:53 +0200)
src/GEOMGUI/GEOM_msg_en.ts
src/GEOMGUI/GEOM_msg_fr.ts
src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx

index 04e9f9d6b3d0f216b01330e36b8353dd3f745367..c8a36982d1b4b362981ab012fcf02a2343f8eba7 100644 (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>
index 20d5ebe4edf192e07e6e38197c2af9d8c924826e..af43089e2bbf70e935595e2ac4256e3967f1420d 100644 (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>
index 9f9ad7a6ce8bda0a08794f041d454ceddcd1d569..73e7c03fa73ee7a3ac4f23257b43557e78b69e1a 100644 (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;