From 9df0497931dac48c8fc7bc943bcc89fae16bf3d3 Mon Sep 17 00:00:00 2001 From: kgv Date: Mon, 14 Sep 2020 14:08:26 +0300 Subject: [PATCH] 0031765: Coding Rules - eliminate GCC compiler warnings -Wcatch-value in IVtk Catched exceptions are now passed by reference and error message is printed. Added Standard_FALLTHROUGH to IVtkOCC_ShapePickerAlgo::SetSelectionMode(). --- src/IVtkOCC/IVtkOCC_SelectableObject.cxx | 11 +++++++---- src/IVtkOCC/IVtkOCC_ShapeMesher.cxx | 18 +++++++++++++----- src/IVtkOCC/IVtkOCC_ShapePickerAlgo.cxx | 14 ++++++++------ 3 files changed, 28 insertions(+), 15 deletions(-) diff --git a/src/IVtkOCC/IVtkOCC_SelectableObject.cxx b/src/IVtkOCC/IVtkOCC_SelectableObject.cxx index 99cef26e93..de09a0a1ef 100644 --- a/src/IVtkOCC/IVtkOCC_SelectableObject.cxx +++ b/src/IVtkOCC/IVtkOCC_SelectableObject.cxx @@ -13,9 +13,11 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. +#include + #include #include -#include +#include #include #include #include @@ -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); } } diff --git a/src/IVtkOCC/IVtkOCC_ShapeMesher.cxx b/src/IVtkOCC/IVtkOCC_ShapeMesher.cxx index 290f96a8ec..13e9113d9e 100644 --- a/src/IVtkOCC/IVtkOCC_ShapeMesher.cxx +++ b/src/IVtkOCC/IVtkOCC_ShapeMesher.cxx @@ -13,6 +13,8 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. +#include + #include #include #include @@ -29,7 +31,7 @@ #include #include #include -#include +#include #include #include #include @@ -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() + ")"); + } } } diff --git a/src/IVtkOCC/IVtkOCC_ShapePickerAlgo.cxx b/src/IVtkOCC/IVtkOCC_ShapePickerAlgo.cxx index fac7391682..ffc2e90fca 100644 --- a/src/IVtkOCC/IVtkOCC_ShapePickerAlgo.cxx +++ b/src/IVtkOCC/IVtkOCC_ShapePickerAlgo.cxx @@ -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; }