]> OCCT Git - occt.git/commitdiff
0031765: Coding Rules - eliminate GCC compiler warnings -Wcatch-value in IVtk
authorkgv <kgv@opencascade.com>
Mon, 14 Sep 2020 11:08:26 +0000 (14:08 +0300)
committerbugmaster <bugmaster@opencascade.com>
Sun, 27 Sep 2020 09:00:07 +0000 (12:00 +0300)
Catched exceptions are now passed by reference and error message is printed.
Added Standard_FALLTHROUGH to IVtkOCC_ShapePickerAlgo::SetSelectionMode().

src/IVtkOCC/IVtkOCC_SelectableObject.cxx
src/IVtkOCC/IVtkOCC_ShapeMesher.cxx
src/IVtkOCC/IVtkOCC_ShapePickerAlgo.cxx

index 99cef26e931d8fa5b3c2d2234831ff2919b5634f..de09a0a1ef867615fcf81327a737923e8659058f 100644 (file)
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
+#include <IVtkOCC_SelectableObject.hxx>
+
 #include <AIS_Shape.hxx>
 #include <BRepBndLib.hxx>
-#include <IVtkOCC_SelectableObject.hxx>
+#include <Message.hxx>
 #include <Select3D_SensitiveBox.hxx>
 #include <SelectMgr_Selection.hxx>
 #include <Standard_ErrorHandler.hxx>
@@ -130,14 +132,15 @@ void IVtkOCC_SelectableObject::ComputeSelection (const Handle(SelectMgr_Selectio
                                        myOCCTDrawer->DeviationAngle(),
                                        isAutoTriangulation);
   }
-  catch (Standard_Failure)
+  catch (const Standard_Failure& anException)
   {
+    Message::SendFail (TCollection_AsciiString("Error: IVtkOCC_SelectableObject::ComputeSelection(") + theMode + ") has failed ("
+                     + anException.GetMessageString() + ")");
     if (theMode == 0)
     {
       Bnd_Box aBndBox = BoundingBox();
       Handle(StdSelect_BRepOwner) aOwner = new StdSelect_BRepOwner (anOcctShape, this);
-      Handle(Select3D_SensitiveBox) aSensitiveBox = 
-        new Select3D_SensitiveBox (aOwner, aBndBox);
+      Handle(Select3D_SensitiveBox) aSensitiveBox = new Select3D_SensitiveBox (aOwner, aBndBox);
       theSelection->Add (aSensitiveBox);
     }
   }
index 290f96a8ec8d7472e7846fce90f0f297911b20d4..13e9113d9e812aa87c34eadb80a31adb1c714b51 100644 (file)
@@ -13,6 +13,8 @@
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
+#include <IVtkOCC_ShapeMesher.hxx>
+
 #include <Adaptor3d_IsoCurve.hxx>
 #include <Bnd_Box.hxx>
 #include <BRep_Tool.hxx>
@@ -29,7 +31,7 @@
 #include <GeomAdaptor_Curve.hxx>
 #include <gp_Dir2d.hxx>
 #include <gp_Pnt2d.hxx>
-#include <IVtkOCC_ShapeMesher.hxx>
+#include <Message.hxx>
 #include <NCollection_Array1.hxx>
 #include <Poly_Polygon3D.hxx>
 #include <Poly_PolygonOnTriangulation.hxx>
@@ -136,8 +138,11 @@ void IVtkOCC_ShapeMesher::meshShape()
       anAlgo->Perform();
     }
   }
-  catch (Standard_Failure)
-  { }
+  catch (const Standard_Failure& anException)
+  {
+    Message::SendFail (TCollection_AsciiString("Error: IVtkOCC_ShapeMesher::meshShape() triangulation builder has failed (")
+                     + anException.GetMessageString() + ")");
+  }
 }
 
 //================================================================
@@ -230,8 +235,11 @@ void IVtkOCC_ShapeMesher::addWireFrameFaces()
       addWFFace (anOcctFace, 
                  GetShapeObj()->GetSubShapeId (anOcctFace));
     }
-    catch (Standard_Failure)
-    { }
+    catch (const Standard_Failure& anException)
+    {
+      Message::SendFail (TCollection_AsciiString("Error: addWireFrameFaces() wireframe presentation builder has failed (")
+                       + anException.GetMessageString() + ")");
+    }
   }
 }
 
index fac73916823e184e470d857e152554018fca6045..ffc2e90fca18fb5ae656fcdd56519706ca39c367 100644 (file)
@@ -128,24 +128,26 @@ void IVtkOCC_ShapePickerAlgo::SetSelectionMode (const IVtk_IShape::Handle& theSh
 
     // Update the selection for the given mode according to its status.
     const Handle(SelectMgr_Selection)& aSel = aSelObj->Selection (theMode);
-
     switch (aSel->UpdateStatus())
     {
       case SelectMgr_TOU_Full:
+      {
         // Recompute the sensitive primitives which correspond to the mode.
         myViewerSelector->RemoveSelectionOfObject (aSelObj, aSelObj->Selection (theMode));
         aSelObj->RecomputePrimitives (theMode);
         myViewerSelector->AddSelectionToObject (aSelObj, aSelObj->Selection (theMode));
         myViewerSelector->RebuildObjectsTree();
         myViewerSelector->RebuildSensitivesTree (aSelObj);
+      }
+      Standard_FALLTHROUGH
       case SelectMgr_TOU_Partial:
+      {
+        if (aSelObj->HasTransformation())
         {
-          if (aSelObj->HasTransformation())
-          {
-            myViewerSelector->RebuildObjectsTree();
-          }
-          break;
+          myViewerSelector->RebuildObjectsTree();
         }
+        break;
+      }
       default:
         break;
     }