Salome HOME
22752: [EDF] Provide explicit feedback on what has been done by Shape Processing...
[modules/geom.git] / src / GEOMImpl / GEOMImpl_CylinderDriver.cxx
index 42dd86b7ce863b0b5acd69cf7b72a2c151529d8e..d7f8a5bee5127d7d0f7c10344b766f218e3d961b 100644 (file)
@@ -109,37 +109,36 @@ Standard_Integer GEOMImpl_CylinderDriver::Execute(TFunction_Logbook& log) const
 
   if (aCI.GetH() < 0.0) aV.Reverse();
   gp_Ax2 anAxes (aP, aV);
-  bool switchAngleVar;
-  if(aType == CYLINDER_R_H || aType == CYLINDER_PNT_VEC_R_H) switchAngleVar = false;
-  else if(aType == CYLINDER_R_H_A || aType == CYLINDER_PNT_VEC_R_H_A) switchAngleVar = true;
-  else return 0;
+
   TopoDS_Shape aShape;
   
-  switch (switchAngleVar) {
-  case false:
-  {
-    BRepPrimAPI_MakeCylinder MC (anAxes, aCI.GetR(), Abs(aCI.GetH()));
-    MC.Build();
-    if (!MC.IsDone()) {
-      StdFail_NotDone::Raise("Cylinder can't be computed from the given parameters");
+  switch (aType) {
+  case CYLINDER_R_H:
+  case CYLINDER_PNT_VEC_R_H:
+    {
+      BRepPrimAPI_MakeCylinder MC (anAxes, aCI.GetR(), Abs(aCI.GetH()));
+      MC.Build();
+      if (!MC.IsDone()) {
+        StdFail_NotDone::Raise("Cylinder can't be computed from the given parameters");
+      }
+      aShape = MC.Shape();
+      break;
     }
-    aShape = MC.Shape();
-    break;
-  }
-  case true:
-  {
-    BRepPrimAPI_MakeCylinder MCA (anAxes, aCI.GetR(), Abs(aCI.GetH()), aCI.GetA());
-    MCA.Build();
-    if (!MCA.IsDone()) {
-      StdFail_NotDone::Raise("Cylinder can't be computed from the given parameters. Failure.");
-      return 0;
+  case CYLINDER_R_H_A:
+  case CYLINDER_PNT_VEC_R_H_A:
+    {
+      BRepPrimAPI_MakeCylinder MC (anAxes, aCI.GetR(), Abs(aCI.GetH()), aCI.GetA());
+      MC.Build();
+      if (!MC.IsDone()) {
+        StdFail_NotDone::Raise("Cylinder can't be computed from the given parameters. Failure.");
+      }
+      aShape = MC.Shape();
+      break;
     }
-    aShape = MCA.Shape();
-    break;
-  }
   default:
-    return 0;
+    break;
   }
+  
   if (aShape.IsNull()) return 0;
   aFunction->SetValue(aShape);
 
@@ -170,16 +169,28 @@ GetCreationInformation(std::string&             theOperationName,
     AddParam( theParams, "Radius", aCI.GetR() );
     AddParam( theParams, "Height", aCI.GetH() );
     break;
-  case CONE_PNT_VEC_R1_R2_H:
+  case CYLINDER_R_H_A:
+    AddParam( theParams, "Radius", aCI.GetR() );
+    AddParam( theParams, "Height", aCI.GetH() );
+    AddParam( theParams, "Angle",  aCI.GetA() );
+    break;
+  case CYLINDER_PNT_VEC_R_H:
     AddParam( theParams, "Base Point", aCI.GetPoint() );
     AddParam( theParams, "Vector", aCI.GetVector() );
     AddParam( theParams, "Radius", aCI.GetR() );
     AddParam( theParams, "Height", aCI.GetH() );
     break;
+  case CYLINDER_PNT_VEC_R_H_A:
+    AddParam( theParams, "Base Point", aCI.GetPoint() );
+    AddParam( theParams, "Vector", aCI.GetVector() );
+    AddParam( theParams, "Radius", aCI.GetR() );
+    AddParam( theParams, "Height", aCI.GetH() );
+    AddParam( theParams, "Angle",  aCI.GetA() );
+    break;
   default:
     return false;
   }
-  
+
   return true;
 }