Salome HOME
0022674:[CEA 1261] Regression of function MakeShell : Rollback type check
authorskv <skv@opencascade.com>
Mon, 25 Aug 2014 08:12:02 +0000 (12:12 +0400)
committerskv <skv@opencascade.com>
Mon, 25 Aug 2014 08:12:02 +0000 (12:12 +0400)
src/GEOMImpl/GEOMImpl_ShapeDriver.cxx

index fe9187ad4501b441183f4a08d4974e79d1f475c8..ffc758bcb60465aae415977b8912bb674bd8bf84 100644 (file)
 #include <Standard_TypeMismatch.hxx>
 #include <Standard_ConstructionError.hxx>
 
+// Uncomment this definition to check if type of created shape is the same
+// as expected. For further details please see the Mantis issue
+// http://salome.mantis.opencascade.com/view.php?id=22674 
+//#define RESULT_TYPE_CHECK
+
 //modified by NIZNHY-PKV Wed Dec 28 13:48:20 2011f
 //static
 //  void KeepEdgesOrder(const Handle(TopTools_HSequenceOfShape)& aEdges,
@@ -134,12 +139,16 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
 
   TopoDS_Shape aShape;
   TCollection_AsciiString aWarning;
+#ifdef RESULT_TYPE_CHECK
   TopAbs_ShapeEnum anExpectedType = TopAbs_SHAPE;
+#endif
 
   BRep_Builder B;
 
   if (aType == WIRE_EDGES) {
+#ifdef RESULT_TYPE_CHECK
     anExpectedType = TopAbs_WIRE;
+#endif
 
     Handle(TColStd_HSequenceOfTransient) aShapes = aCI.GetShapes();
 
@@ -150,7 +159,9 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
     aShape = MakeWireFromEdges(aShapes, aTolerance);
   }
   else if (aType == FACE_WIRE) {
+#ifdef RESULT_TYPE_CHECK
     anExpectedType = TopAbs_FACE;
+#endif
 
     Handle(GEOM_Function) aRefBase = aCI.GetBase();
     TopoDS_Shape aShapeBase = aRefBase->GetValue();
@@ -185,7 +196,9 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
     }
   }
   else if (aType == FACE_WIRES) {
+#ifdef RESULT_TYPE_CHECK
     anExpectedType = TopAbs_FACE;
+#endif
 
     // Try to build a face from a set of wires and edges
     int ind;
@@ -303,7 +316,9 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
     }
   }
   else if (aType == SHELL_FACES) {
+#ifdef RESULT_TYPE_CHECK
     anExpectedType = TopAbs_SHELL;
+#endif
 
     Handle(TColStd_HSequenceOfTransient) aShapes = aCI.GetShapes();
     unsigned int ind, nbshapes = aShapes->Length();
@@ -362,7 +377,9 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
 
   }
   else if (aType == SOLID_SHELL) {
+#ifdef RESULT_TYPE_CHECK
     anExpectedType = TopAbs_SOLID;
+#endif
 
     Handle(GEOM_Function) aRefShell = aCI.GetBase();
     TopoDS_Shape aShapeShell = aRefShell->GetValue();
@@ -391,7 +408,9 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
 
   }
   else if (aType == SOLID_SHELLS) {
+#ifdef RESULT_TYPE_CHECK
     anExpectedType = TopAbs_SOLID;
+#endif
 
     Handle(TColStd_HSequenceOfTransient) aShapes = aCI.GetShapes();
     unsigned int ind, nbshapes = aShapes->Length();
@@ -425,7 +444,9 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
       aShape = Sol;
   }
   else if (aType == COMPOUND_SHAPES) {
+#ifdef RESULT_TYPE_CHECK
     anExpectedType = TopAbs_COMPOUND;
+#endif
 
     Handle(TColStd_HSequenceOfTransient) aShapes = aCI.GetShapes();
     unsigned int ind, nbshapes = aShapes->Length();
@@ -470,7 +491,9 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
   }
   */
   else if (aType == EDGE_WIRE) {
+#ifdef RESULT_TYPE_CHECK
     anExpectedType = TopAbs_EDGE;
+#endif
 
     Handle(GEOM_Function) aRefBase = aCI.GetBase();
     TopoDS_Shape aWire = aRefBase->GetValue();
@@ -481,7 +504,9 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
     aShape = MakeEdgeFromWire(aWire, LinTol, AngTol);
   }
   else if (aType == EDGE_CURVE_LENGTH) {
+#ifdef RESULT_TYPE_CHECK
     anExpectedType = TopAbs_EDGE;
+#endif
 
     GEOMImpl_IVector aVI (aFunction);
 
@@ -557,7 +582,9 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
     if (aME.IsDone())
       aShape = aME.Shape();
   } else if (aType == SHAPE_ISOLINE) {
+#ifdef RESULT_TYPE_CHECK
     anExpectedType = TopAbs_EDGE;
+#endif
 
     GEOMImpl_IIsoline     aII (aFunction);
     Handle(GEOM_Function) aRefFace = aII.GetFace();
@@ -600,6 +627,7 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
     aShape = aSfs->Shape();
   }
 
+#ifdef RESULT_TYPE_CHECK
   // Check if the result shape type is compatible with the expected.
   const TopAbs_ShapeEnum aShType = aShape.ShapeType();
 
@@ -626,6 +654,7 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
       Standard_ConstructionError::Raise("Result type check failed");
     }
   }
+#endif
 
   aFunction->SetValue(aShape);