From: inv Date: Wed, 29 Dec 2010 11:12:27 +0000 (+0000) Subject: Code refactoring X-Git-Tag: Start_BR_19998_21191~105 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=5a0b94e3b5de09a462b447bd0b07dfc8defdf27a;p=modules%2Fgeom.git Code refactoring --- diff --git a/src/AdvancedGUI/AdvancedGUI_PipeTShapeDlg.cxx b/src/AdvancedGUI/AdvancedGUI_PipeTShapeDlg.cxx index d8563cff8..7f22c4fdd 100644 --- a/src/AdvancedGUI/AdvancedGUI_PipeTShapeDlg.cxx +++ b/src/AdvancedGUI/AdvancedGUI_PipeTShapeDlg.cxx @@ -410,10 +410,9 @@ void AdvancedGUI_PipeTShapeDlg::SelectionIntoArgument() { // nbSel == 1 if (aSelList.Extent() == 1) { - Standard_Boolean aRes = Standard_False; Handle(SALOME_InteractiveObject) anIO = aSelList.First(); - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(anIO, aRes); - if (!CORBA::is_nil(aSelectedObject) && aRes) { + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(anIO); + if (!CORBA::is_nil(aSelectedObject)) { QString aName = GEOMBase::GetName(aSelectedObject); TopoDS_Shape aShape; if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull()) { @@ -471,9 +470,8 @@ void AdvancedGUI_PipeTShapeDlg::SelectionIntoArgument() { DisplayPreview(); } -// Standard_Boolean testResult = Standard_False; -// GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult); -// if (!testResult || aSelectedObject->_is_nil()) +// GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First()); +// if (aSelectedObject->_is_nil()) // return; // // myEditCurrentArgument->setText(GEOMBase::GetName(aSelectedObject)); diff --git a/src/BasicGUI/BasicGUI_ArcDlg.cxx b/src/BasicGUI/BasicGUI_ArcDlg.cxx index ad6ebb30f..1fb73235b 100644 --- a/src/BasicGUI/BasicGUI_ArcDlg.cxx +++ b/src/BasicGUI/BasicGUI_ArcDlg.cxx @@ -269,9 +269,8 @@ void BasicGUI_ArcDlg::SelectionIntoArgument() } } // nbSel == 1 - Standard_Boolean aRes = Standard_False; - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aRes); - if ( !CORBA::is_nil( aSelectedObject ) && aRes ) { + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() ); + if ( !CORBA::is_nil( aSelectedObject ) ) { QString aName = GEOMBase::GetName(aSelectedObject); // Get Selected object if selected subshape diff --git a/src/BasicGUI/BasicGUI_CircleDlg.cxx b/src/BasicGUI/BasicGUI_CircleDlg.cxx index 5c9ab11c0..3cebf40e4 100644 --- a/src/BasicGUI/BasicGUI_CircleDlg.cxx +++ b/src/BasicGUI/BasicGUI_CircleDlg.cxx @@ -334,9 +334,8 @@ void BasicGUI_CircleDlg::SelectionIntoArgument() // nbSel == 1 Handle(SALOME_InteractiveObject) anIO = aList.First(); - Standard_Boolean aRes = Standard_False; - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(anIO, aRes); - if ( !CORBA::is_nil( aSelectedObject ) && aRes ) { + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIO ); + if ( !CORBA::is_nil( aSelectedObject ) ) { QString aName = GEOMBase::GetName( aSelectedObject ); TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX; diff --git a/src/BasicGUI/BasicGUI_CurveDlg.cxx b/src/BasicGUI/BasicGUI_CurveDlg.cxx index b1c6f000f..2a962c461 100644 --- a/src/BasicGUI/BasicGUI_CurveDlg.cxx +++ b/src/BasicGUI/BasicGUI_CurveDlg.cxx @@ -286,8 +286,6 @@ void BasicGUI_CurveDlg::SelectionIntoArgument() { myEditCurrentArgument->setText( "" ); - Standard_Boolean aRes = Standard_False; - SalomeApp_Application* app = myGeomGUI->getApp(); SalomeApp_Study* appStudy = dynamic_cast(app->activeStudy()); _PTR(Study) aDStudy = appStudy->studyDS(); @@ -308,8 +306,8 @@ void BasicGUI_CurveDlg::SelectionIntoArgument() // that will actually be put into myPoints for (SALOME_ListIteratorOfListIO anIt (selected); anIt.More(); anIt.Next()) { - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(anIt.Value(), aRes); - if (!CORBA::is_nil(aSelectedObject) && aRes) { + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIt.Value() ); + if (!CORBA::is_nil(aSelectedObject) ) { if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull()) { aSelMgr->GetIndexes(anIt.Value(), aMapIndexes); diff --git a/src/BasicGUI/BasicGUI_EllipseDlg.cxx b/src/BasicGUI/BasicGUI_EllipseDlg.cxx index 40af9d35e..9cf7b8e01 100644 --- a/src/BasicGUI/BasicGUI_EllipseDlg.cxx +++ b/src/BasicGUI/BasicGUI_EllipseDlg.cxx @@ -235,10 +235,9 @@ void BasicGUI_EllipseDlg::SelectionIntoArgument() return; } - Standard_Boolean aRes = Standard_False; Handle(SALOME_InteractiveObject) anIO = aSelList.First(); - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(anIO, aRes); - if (!CORBA::is_nil(aSelectedObject) && aRes) { + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIO ); + if (!CORBA::is_nil(aSelectedObject) ) { QString aName = GEOMBase::GetName(aSelectedObject); // Get Selected object if selected subshape diff --git a/src/BasicGUI/BasicGUI_LineDlg.cxx b/src/BasicGUI/BasicGUI_LineDlg.cxx index 4e2e4d77e..c0261ec83 100644 --- a/src/BasicGUI/BasicGUI_LineDlg.cxx +++ b/src/BasicGUI/BasicGUI_LineDlg.cxx @@ -252,9 +252,8 @@ void BasicGUI_LineDlg::SelectionIntoArgument() return; } - Standard_Boolean aRes = Standard_False; - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aRes); - if ( !CORBA::is_nil( aSelectedObject ) && aRes ) { + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() ); + if ( !CORBA::is_nil( aSelectedObject ) ) { QString aName = GEOMBase::GetName( aSelectedObject ); TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX; if ( myEditCurrentArgument == GroupFaces->LineEdit1 || diff --git a/src/BasicGUI/BasicGUI_MarkerDlg.cxx b/src/BasicGUI/BasicGUI_MarkerDlg.cxx index 6a2007aef..2b4c26e22 100644 --- a/src/BasicGUI/BasicGUI_MarkerDlg.cxx +++ b/src/BasicGUI/BasicGUI_MarkerDlg.cxx @@ -333,11 +333,10 @@ void BasicGUI_MarkerDlg::onSelectionDone0() aSelMgr->selectedObjects(aSelList); if (aSelList.Extent() == 1) { - Standard_Boolean aRes = Standard_False; Handle(SALOME_InteractiveObject) anIO = aSelList.First(); - GEOM::GEOM_Object_var aSelectedObj = GEOMBase::ConvertIOinGEOMObject(anIO, aRes); + GEOM::GEOM_Object_var aSelectedObj = GEOMBase::ConvertIOinGEOMObject( anIO ); - if ( aRes && !aSelectedObj->_is_nil() ) { + if ( !aSelectedObj->_is_nil() ) { TopoDS_Shape aShape; if ( GEOMBase::GetShape( aSelectedObj, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) { // Existing LCS selected @@ -409,11 +408,10 @@ void BasicGUI_MarkerDlg::onSelectionDone() aSelMgr->selectedObjects(aSelList); if (aSelList.Extent() == 1) { - Standard_Boolean aRes = Standard_False; Handle(SALOME_InteractiveObject) anIO = aSelList.First(); - GEOM::GEOM_Object_var aSelectedObj = GEOMBase::ConvertIOinGEOMObject( anIO, aRes ); + GEOM::GEOM_Object_var aSelectedObj = GEOMBase::ConvertIOinGEOMObject( anIO ); - if ( !CORBA::is_nil( aSelectedObj ) && aRes ) { + if ( !CORBA::is_nil( aSelectedObj ) ) { QString aName = GEOMBase::GetName( aSelectedObj ); if ( getConstructorId() == 1 ) { // by shape position diff --git a/src/BasicGUI/BasicGUI_PlaneDlg.cxx b/src/BasicGUI/BasicGUI_PlaneDlg.cxx index b7462a70f..e87cde189 100644 --- a/src/BasicGUI/BasicGUI_PlaneDlg.cxx +++ b/src/BasicGUI/BasicGUI_PlaneDlg.cxx @@ -442,9 +442,8 @@ void BasicGUI_PlaneDlg::SelectionIntoArgument() } // nbSel == 1 - Standard_Boolean aRes = Standard_False; - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aRes); - if ( !CORBA::is_nil( aSelectedObject ) && aRes ) { + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() ); + if ( !CORBA::is_nil( aSelectedObject ) ) { QString aName = GEOMBase::GetName( aSelectedObject ); TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX; if ( myEditCurrentArgument == GroupPntDir->LineEdit2 || myEditCurrentArgument == Group2Vec->LineEdit1 || myEditCurrentArgument == Group2Vec->LineEdit2) diff --git a/src/BasicGUI/BasicGUI_PointDlg.cxx b/src/BasicGUI/BasicGUI_PointDlg.cxx index 8042083ed..e5db36d90 100644 --- a/src/BasicGUI/BasicGUI_PointDlg.cxx +++ b/src/BasicGUI/BasicGUI_PointDlg.cxx @@ -489,10 +489,9 @@ void BasicGUI_PointDlg::SelectionIntoArgument() aSelMgr->selectedObjects(aSelList); if (aSelList.Extent() == 1) { - Standard_Boolean aRes = Standard_False; Handle(SALOME_InteractiveObject) anIO = aSelList.First(); - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIO, aRes ); - if ( !CORBA::is_nil( aSelectedObject ) && aRes ) { + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIO ); + if ( !CORBA::is_nil( aSelectedObject ) ) { QString aName = GEOMBase::GetName(aSelectedObject); TopoDS_Shape aShape; if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) { @@ -531,7 +530,7 @@ void BasicGUI_PointDlg::SelectionIntoArgument() else { // Global Selection if ( aShape.ShapeType() != myNeedType ) { aSelectedObject = GEOM::GEOM_Object::_nil(); - aName = ""; + aName = ""; if ( id == GEOM_POINT_XYZ ) return; } } diff --git a/src/BasicGUI/BasicGUI_VectorDlg.cxx b/src/BasicGUI/BasicGUI_VectorDlg.cxx index 5d42f980f..50cbb35e4 100644 --- a/src/BasicGUI/BasicGUI_VectorDlg.cxx +++ b/src/BasicGUI/BasicGUI_VectorDlg.cxx @@ -286,9 +286,8 @@ void BasicGUI_VectorDlg::SelectionIntoArgument() } // nbSel == 1 - Standard_Boolean aRes = Standard_False; - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aRes); - if (!CORBA::is_nil(aSelectedObject) && aRes) { + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() ); + if (!CORBA::is_nil(aSelectedObject) ) { QString aName = GEOMBase::GetName(aSelectedObject); TopoDS_Shape aShape; diff --git a/src/BlocksGUI/BlocksGUI_BlockDlg.cxx b/src/BlocksGUI/BlocksGUI_BlockDlg.cxx index 5c5458896..3817b4e15 100644 --- a/src/BlocksGUI/BlocksGUI_BlockDlg.cxx +++ b/src/BlocksGUI/BlocksGUI_BlockDlg.cxx @@ -247,10 +247,9 @@ void BlocksGUI_BlockDlg::SelectionIntoArgument() } // nbSel == 1 - Standard_Boolean testResult = Standard_False; - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult); + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() ); - if (!testResult || CORBA::is_nil(aSelectedObject)) + if ( CORBA::is_nil(aSelectedObject) ) return; QString aName = GEOMBase::GetName(aSelectedObject); diff --git a/src/BlocksGUI/BlocksGUI_ExplodeDlg.cxx b/src/BlocksGUI/BlocksGUI_ExplodeDlg.cxx index 1c2c06bc3..b58524ac6 100644 --- a/src/BlocksGUI/BlocksGUI_ExplodeDlg.cxx +++ b/src/BlocksGUI/BlocksGUI_ExplodeDlg.cxx @@ -213,10 +213,9 @@ void BlocksGUI_ExplodeDlg::SelectionIntoArgument() aSelMgr->selectedObjects(aSelList); if (aSelList.Extent() == 1) { - Standard_Boolean aResult = Standard_False; - GEOM::GEOM_Object_var anObj = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aResult); + GEOM::GEOM_Object_var anObj = GEOMBase::ConvertIOinGEOMObject( aSelList.First() ); - if (aResult && !anObj->_is_nil() && GEOMBase::IsShape(anObj)) { + if ( GEOMBase::IsShape(anObj) ) { myObject = anObj; myGrp1->LineEdit1->setText(GEOMBase::GetName(anObj)); } diff --git a/src/BlocksGUI/BlocksGUI_PropagateDlg.cxx b/src/BlocksGUI/BlocksGUI_PropagateDlg.cxx index d98fe58fa..dff963899 100644 --- a/src/BlocksGUI/BlocksGUI_PropagateDlg.cxx +++ b/src/BlocksGUI/BlocksGUI_PropagateDlg.cxx @@ -156,9 +156,8 @@ void BlocksGUI_PropagateDlg::SelectionIntoArgument() if (aSelList.Extent() == 1) { Handle(SALOME_InteractiveObject) anIO = aSelList.First(); - Standard_Boolean aRes; - myObject = GEOMBase::ConvertIOinGEOMObject( anIO, aRes ); - if ( aRes ) + myObject = GEOMBase::ConvertIOinGEOMObject( anIO ); + if ( !CORBA::is_nil( myObject ) ) myGrp->LineEdit1->setText( GEOMBase::GetName( myObject ) ); } } diff --git a/src/BlocksGUI/BlocksGUI_QuadFaceDlg.cxx b/src/BlocksGUI/BlocksGUI_QuadFaceDlg.cxx index f458dc051..6886ae2bf 100644 --- a/src/BlocksGUI/BlocksGUI_QuadFaceDlg.cxx +++ b/src/BlocksGUI/BlocksGUI_QuadFaceDlg.cxx @@ -239,9 +239,8 @@ void BlocksGUI_QuadFaceDlg::SelectionIntoArgument() GEOM::GEOM_Object_var anObj = GEOM::GEOM_Object::_nil(); if (aSelList.Extent() == 1) { - Standard_Boolean aResult = Standard_False; - anObj = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aResult); - if (aResult && !anObj->_is_nil()) { + anObj = GEOMBase::ConvertIOinGEOMObject(aSelList. First() ); + if ( !anObj->_is_nil() ) { aName = GEOMBase::GetName(anObj); // Get Selected object if selected subshape diff --git a/src/BlocksGUI/BlocksGUI_TrsfDlg.cxx b/src/BlocksGUI/BlocksGUI_TrsfDlg.cxx index c44d44a1b..bb85389b8 100644 --- a/src/BlocksGUI/BlocksGUI_TrsfDlg.cxx +++ b/src/BlocksGUI/BlocksGUI_TrsfDlg.cxx @@ -240,10 +240,9 @@ void BlocksGUI_TrsfDlg::SelectionIntoArgument() { // If selection of main object is activated if (aSelList.Extent() == 1) { - Standard_Boolean aResult = Standard_False; - anObj = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aResult); + anObj = GEOMBase::ConvertIOinGEOMObject( aSelList.First() ); - if (aResult && !anObj->_is_nil() && GEOMBase::IsShape(anObj)) { + if ( GEOMBase::IsShape(anObj) ) { aName = GEOMBase::GetName(anObj); } } @@ -257,9 +256,8 @@ void BlocksGUI_TrsfDlg::SelectionIntoArgument() // If face selection is activated int anIndex = -1; if (aSelList.Extent() == 1) { - Standard_Boolean aResult = Standard_False; - anObj = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aResult); - if (aResult && !anObj->_is_nil() && GEOMBase::IsShape(anObj)) { + anObj = GEOMBase::ConvertIOinGEOMObject( aSelList.First() ); + if ( GEOMBase::IsShape(anObj) ) { aName = GEOMBase::GetName(anObj); TColStd_IndexedMapOfInteger anIndexes; aSelMgr->GetIndexes(aSelList.First(), anIndexes); diff --git a/src/BooleanGUI/BooleanGUI_Dialog.cxx b/src/BooleanGUI/BooleanGUI_Dialog.cxx index 36575066a..768dfdba1 100644 --- a/src/BooleanGUI/BooleanGUI_Dialog.cxx +++ b/src/BooleanGUI/BooleanGUI_Dialog.cxx @@ -209,9 +209,8 @@ void BooleanGUI_Dialog::SelectionIntoArgument() } // nbSel == 1 - Standard_Boolean aRes = Standard_False; - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aRes); - if (!CORBA::is_nil(aSelectedObject) && aRes && GEOMBase::IsShape(aSelectedObject)) + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() ); + if ( GEOMBase::IsShape(aSelectedObject) ) { myEditCurrentArgument->setText(GEOMBase::GetName(aSelectedObject)); @@ -314,9 +313,8 @@ GEOM::GEOM_IOperations_ptr BooleanGUI_Dialog::createOperation() bool BooleanGUI_Dialog::isValid (QString&) { //Handle(SALOME_InteractiveObject) IO = firstIObject(); - //Standard_Boolean testResult; - //GEOM::GEOM_Object_var anObject = GEOMBase::ConvertIOinGEOMObject(IO, testResult); - //if (!testResult || anObject->_is_nil()) + //GEOM::GEOM_Object_var anObject = GEOMBase::ConvertIOinGEOMObject( IO ); + //if ( anObject->_is_nil() ) // return false; return !CORBA::is_nil(myObject1) && !CORBA::is_nil(myObject2); diff --git a/src/BuildGUI/BuildGUI_EdgeDlg.cxx b/src/BuildGUI/BuildGUI_EdgeDlg.cxx index 33e9f1e50..aa02e252d 100644 --- a/src/BuildGUI/BuildGUI_EdgeDlg.cxx +++ b/src/BuildGUI/BuildGUI_EdgeDlg.cxx @@ -246,10 +246,9 @@ void BuildGUI_EdgeDlg::SelectionIntoArgument() } // nbSel == 1 - Standard_Boolean testResult = Standard_False; - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult); + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() ); - if ( testResult && !aSelectedObject->_is_nil() ) { + if ( !aSelectedObject->_is_nil() ) { QString aName = GEOMBase::GetName( aSelectedObject ); TopAbs_ShapeEnum aNeedType = myEditCurrentArgument == GroupWire->LineEdit1 ? TopAbs_WIRE : TopAbs_VERTEX; diff --git a/src/BuildGUI/BuildGUI_WireDlg.cxx b/src/BuildGUI/BuildGUI_WireDlg.cxx index a769ce1c1..bfb66731f 100644 --- a/src/BuildGUI/BuildGUI_WireDlg.cxx +++ b/src/BuildGUI/BuildGUI_WireDlg.cxx @@ -216,11 +216,10 @@ void BuildGUI_WireDlg::SelectionIntoArgument() std::list aList; // subshapes list TopoDS_Shape aShape; - Standard_Boolean aRes = Standard_False; for (SALOME_ListIteratorOfListIO anIt (aSelList); anIt.More(); anIt.Next()) { TColStd_IndexedMapOfInteger aMap; - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIt.Value(), aRes ); - if ( !CORBA::is_nil(aSelectedObject) && aRes && GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) { + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIt.Value() ); + if ( !CORBA::is_nil(aSelectedObject) && GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) { aSelMgr->GetIndexes( anIt.Value(), aMap ); if ( aMap.Extent() > 0 ) { // local selection diff --git a/src/EntityGUI/EntityGUI_3DSketcherDlg.cxx b/src/EntityGUI/EntityGUI_3DSketcherDlg.cxx index 43e6e8981..d2a827229 100755 --- a/src/EntityGUI/EntityGUI_3DSketcherDlg.cxx +++ b/src/EntityGUI/EntityGUI_3DSketcherDlg.cxx @@ -299,9 +299,8 @@ void EntityGUI_3DSketcherDlg::SelectionIntoArgument() int nbSel = aSelList.Extent(); if ( nbSel == 1 ) { - Standard_Boolean aRes = Standard_False; - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aRes); - if (!CORBA::is_nil(aSelectedObject) && aRes) { + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() ); + if ( !CORBA::is_nil(aSelectedObject) ) { TopoDS_Shape aShape; if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE)) { // Explore the shape if its a local selection TColStd_IndexedMapOfInteger aMap; diff --git a/src/EntityGUI/EntityGUI_SketcherDlg.cxx b/src/EntityGUI/EntityGUI_SketcherDlg.cxx index 26f75a952..c895f423c 100644 --- a/src/EntityGUI/EntityGUI_SketcherDlg.cxx +++ b/src/EntityGUI/EntityGUI_SketcherDlg.cxx @@ -1144,9 +1144,8 @@ void EntityGUI_SketcherDlg::SelectionIntoArgument() int nbSel = aSelList.Extent(); if (nbSel == 1 && myEditCurrentArgument == Group1Sel->LineEdit1) { - Standard_Boolean aRes = Standard_False; - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aRes); - if (!CORBA::is_nil(aSelectedObject) && aRes) { + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() ); + if ( !CORBA::is_nil(aSelectedObject) ) { TopoDS_Shape aShape; if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_VERTEX)) { gp_Trsf aTrans; @@ -1188,9 +1187,8 @@ void EntityGUI_SketcherDlg::SelectionIntoArgument() } if (nbSel == 1 && myEditCurrentArgument == Group1Sel1Spin->LineEdit1) { - Standard_Boolean aRes = Standard_False; - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aRes); - if (!CORBA::is_nil(aSelectedObject) && aRes) { + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() ); + if ( !CORBA::is_nil(aSelectedObject) ) { TopoDS_Shape aShape; if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_VERTEX)) { gp_Trsf aTrans; @@ -1232,9 +1230,8 @@ void EntityGUI_SketcherDlg::SelectionIntoArgument() } if (nbSel == 1 && myEditCurrentArgument == Group2Sel->LineEdit1) { - Standard_Boolean aRes = Standard_False; - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aRes); - if (!CORBA::is_nil(aSelectedObject) && aRes) { + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() ); + if ( !CORBA::is_nil(aSelectedObject) ) { TopoDS_Shape aShape; if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_VERTEX)) { gp_Trsf aTrans; @@ -1280,9 +1277,8 @@ void EntityGUI_SketcherDlg::SelectionIntoArgument() myX=tmpX; // If yes keep the old values of X and Y myY=tmpY; } - Standard_Boolean aRes = Standard_False; - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aRes); - if (!CORBA::is_nil(aSelectedObject) && aRes) { + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() ); + if ( !CORBA::is_nil(aSelectedObject) ) { TopoDS_Shape aShape; if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_VERTEX)) { gp_Trsf aTrans; diff --git a/src/EntityGUI/EntityGUI_SubShapeDlg.cxx b/src/EntityGUI/EntityGUI_SubShapeDlg.cxx index b444ab1df..4fff52145 100644 --- a/src/EntityGUI/EntityGUI_SubShapeDlg.cxx +++ b/src/EntityGUI/EntityGUI_SubShapeDlg.cxx @@ -213,7 +213,6 @@ void EntityGUI_SubShapeDlg::SelectionIntoArgument() if (nbSel != 1) return; - TopoDS_Shape S; Handle(SALOME_InteractiveObject) IO = aSelList.First(); if ( !IO->hasEntry() ) { SUIT_Session::session()->activeApplication()->putInfo( tr( "GEOM_PRP_SHAPE_IN_STUDY" ) ); @@ -221,17 +220,15 @@ void EntityGUI_SubShapeDlg::SelectionIntoArgument() return; } - if (!GEOMBase::GetTopoFromSelection(aSelList, S) || - S.IsNull() || - S.ShapeType() == TopAbs_VERTEX) { + TopoDS_Shape S = GEOMBase::GetTopoFromSelection( aSelList ); + if ( S.IsNull() || S.ShapeType() == TopAbs_VERTEX ) { myObject = GEOM::GEOM_Object::_nil(); updateButtonState(); return; } - Standard_Boolean testResult; - myObject = GEOMBase::ConvertIOinGEOMObject(IO, testResult); - if (!testResult || myObject->_is_nil()) { + myObject = GEOMBase::ConvertIOinGEOMObject( IO ); + if ( myObject->_is_nil() ) { updateButtonState(); return; } @@ -537,9 +534,8 @@ bool EntityGUI_SubShapeDlg::isValid (QString& msg) aSelMgr->selectedObjects(aSelList); if (aSelList.Extent() == 1) { - Standard_Boolean testResult; - GEOM::GEOM_Object_var anObj = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult); - if (testResult && !anObj->_is_nil()) { + GEOM::GEOM_Object_var anObj = GEOMBase::ConvertIOinGEOMObject( aSelList.First() ); + if ( !anObj->_is_nil() ) { TColStd_IndexedMapOfInteger aMapIndex; aSelMgr->GetIndexes(aSelList.First(), aMapIndex); isOk = aMapIndex.Extent() > 0; @@ -572,11 +568,10 @@ bool EntityGUI_SubShapeDlg::execute (ObjectList& objects) aSelMgr->selectedObjects(aSelList); if (aSelList.Extent() == 1) { - Standard_Boolean aResult = Standard_False; GEOM::GEOM_Object_var anObj = - GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aResult); + GEOMBase::ConvertIOinGEOMObject( aSelList.First() ); - if (aResult && !anObj->_is_nil()) { + if ( !anObj->_is_nil() ) { TColStd_IndexedMapOfInteger aMapIndex; aSelMgr->GetIndexes(aSelList.First(), aMapIndex); diff --git a/src/GEOMBase/GEOMBase.cxx b/src/GEOMBase/GEOMBase.cxx index c35c11ea4..d72fc1019 100644 --- a/src/GEOMBase/GEOMBase.cxx +++ b/src/GEOMBase/GEOMBase.cxx @@ -70,23 +70,14 @@ //===================================================================================== // function : GetShapeFromIOR() -// purpose : exist also as static method ! +// purpose : Get shape data by the specified IOR //===================================================================================== -TopoDS_Shape GEOMBase::GetShapeFromIOR(QString IOR) +TopoDS_Shape GEOMBase::GetShapeFromIOR( const QString& IOR ) { - TopoDS_Shape result; - if(IOR.trimmed().isEmpty()) - return result; - - CORBA::Object_var obj = SalomeApp_Application::orb()->string_to_object(IOR.toLatin1().data()); - if(CORBA::is_nil(obj)) - return result; - GEOM::GEOM_Object_var GeomObject = GEOM::GEOM_Object::_narrow( obj ); - if (GeomObject->_is_nil()) - return result; - - result = GEOM_Client::get_client().GetShape(GeometryGUI::GetGeomGen(), GeomObject); - return result; + GEOM::GEOM_Object_var geomObj = GEOMBase::GetObjectFromIOR( IOR ); + TopoDS_Shape shape; + GetShape( geomObj, shape, TopAbs_SHAPE ); + return shape; } @@ -94,16 +85,16 @@ TopoDS_Shape GEOMBase::GetShapeFromIOR(QString IOR) // function : GetIndex() // purpose : Get the index of a sub shape in a main shape : index start at 1 //===================================================================================== -int GEOMBase::GetIndex(const TopoDS_Shape& subshape, const TopoDS_Shape& shape, int /*ShapeType*/) +int GEOMBase::GetIndex( const TopoDS_Shape& subshape, const TopoDS_Shape& shape ) { - if(shape.IsNull() || subshape.IsNull()) - return -1; - - TopTools_IndexedMapOfShape anIndices; - TopExp::MapShapes(shape, anIndices); - if(anIndices.Contains(subshape)) return anIndices.FindIndex(subshape); - - return -1; + int idx = -1; + if ( !shape.IsNull() && !subshape.IsNull() ) { + TopTools_IndexedMapOfShape anIndices; + TopExp::MapShapes( shape, anIndices ); + if ( anIndices.Contains( subshape ) ) + idx = anIndices.FindIndex( subshape ); + } + return idx; } @@ -111,82 +102,64 @@ int GEOMBase::GetIndex(const TopoDS_Shape& subshape, const TopoDS_Shape& shape, // function : GetTopoFromSelection() // purpose : Define tds from a single selection and retuen true //======================================================================= -bool GEOMBase::GetTopoFromSelection(const SALOME_ListIO& aList, TopoDS_Shape& tds) +TopoDS_Shape GEOMBase::GetTopoFromSelection( const SALOME_ListIO& IObjects ) { - if(aList.Extent() != 1) - return false; - - Handle(SALOME_InteractiveObject) IO = aList.First(); - /* case SObject */ - if(IO->hasEntry()) { - SalomeApp_Study* appStudy = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); - if ( !appStudy ) return false; - _PTR(Study) aStudy = appStudy->studyDS(); - - _PTR(SObject) obj ( aStudy->FindObjectID(IO->getEntry()) ); - _PTR(GenericAttribute) anAttr; - if( obj ) { - if(obj->FindAttribute(anAttr, "AttributeIOR")) { - _PTR(AttributeIOR) anIOR ( anAttr ); - tds = GetShapeFromIOR(anIOR->Value().c_str()); - if(tds.IsNull()) - return false; - else - return true; + TopoDS_Shape shape; + if ( IObjects.Extent() == 1 ){ + Handle(SALOME_InteractiveObject) IO = IObjects.First(); + SalomeApp_Study* study = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); + if ( IO->hasEntry() && study ) { + _PTR(Study) studyDS = study->studyDS(); + _PTR(SObject) obj( studyDS->FindObjectID( IO->getEntry() ) ); + _PTR(GenericAttribute) anAttr; + if ( obj && obj->FindAttribute( anAttr, "AttributeIOR" ) ) { + _PTR(AttributeIOR) anIOR( anAttr ); + shape = GetShapeFromIOR( anIOR->Value().c_str() ); } } } - - return false; + return shape; } //======================================================================= // function : GetNameOfSelectedIObjects() // purpose : Define the name geom++ or other name of mono or multi sel. //======================================================================= -int GEOMBase::GetNameOfSelectedIObjects( const SALOME_ListIO& aList, - QString& theName, - const bool theShapesOnly ) +int GEOMBase::GetNameOfSelectedIObjects( const SALOME_ListIO& IObjects, + QString& name, + const bool shapesOnly ) { - if ( !theShapesOnly ) - { - int nbSel = aList.Extent(); - if ( nbSel == 1 ) - { - Handle(SALOME_InteractiveObject) anIObj = aList.First(); - if(anIObj->hasEntry()) { - SalomeApp_Study* appStudy = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); - if ( !appStudy ) return nbSel; - _PTR(Study) aStudy = appStudy->studyDS(); - - _PTR(SObject) obj ( aStudy->FindObjectID(anIObj->getEntry()) ); - - _PTR(GenericAttribute) anAttr; - - if ( obj && obj->FindAttribute( anAttr, "AttributeName") ) - { - _PTR(AttributeName) aNameAttr ( anAttr ); - theName = aNameAttr->Value().c_str(); - } - } - } - else - theName = QObject::tr("%1_objects").arg(nbSel); - - return nbSel; - } - else - { - GEOM::ListOfGO anObjs; - ConvertListOfIOInListOfGO( aList, anObjs, theShapesOnly ); - if ( anObjs.length() == 1 ) { - theName = GetName( anObjs[ 0 ] ); + int nbSel = 0; + name = ""; // clear output name + + if ( !shapesOnly ) { + nbSel = IObjects.Extent(); + if ( nbSel == 1 ) { + Handle(SALOME_InteractiveObject) anIObj = IObjects.First(); + SalomeApp_Study* study = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); + if ( anIObj->hasEntry() && study ) { + _PTR(Study) studyDS = study->studyDS(); + _PTR(SObject) obj( studyDS->FindObjectID( anIObj->getEntry() ) ); + _PTR(GenericAttribute) anAttr; + if ( obj && obj->FindAttribute( anAttr, "AttributeName" ) ) { + _PTR(AttributeName) aNameAttr ( anAttr ); + name = aNameAttr->Value().c_str(); + } } - else - theName = QString( "%1_objects" ).arg( anObjs.length() ); - - return anObjs.length(); } + } + else { + GEOM::ListOfGO anObjs; + ConvertListOfIOInListOfGO( IObjects, anObjs, shapesOnly ); + nbSel = anObjs.length(); + if ( nbSel == 1 ) + name = GetName( anObjs[ 0 ] ); + } + + if ( nbSel > 1 ) + name = QObject::tr( "%1_objects" ).arg( nbSel ); + + return nbSel; } @@ -194,101 +167,113 @@ int GEOMBase::GetNameOfSelectedIObjects( const SALOME_ListIO& aList, // function : GetShapeTypeString() // purpose : for a single shape //================================================================================= -bool GEOMBase::GetShapeTypeString(const TopoDS_Shape& aShape, Standard_CString& aTypeString) +QString GEOMBase::GetShapeTypeString(const TopoDS_Shape& shape) { - if(aShape.IsNull()) { - aTypeString = "aNullShape"; - return false; - } - switch(aShape.ShapeType()) - { + QString aTypeString; + if ( !shape.IsNull() ) { + switch ( shape.ShapeType() ) { case TopAbs_COMPOUND: { - aTypeString = CORBA::string_dup(QObject::tr("GEOM_COMPOUND").toLatin1().constData()); - return true; + aTypeString = QObject::tr( "GEOM_COMPOUND" ); + break; } - case TopAbs_COMPSOLID: + case TopAbs_COMPSOLID: { - aTypeString = CORBA::string_dup(QObject::tr("GEOM_COMPOUNDSOLID").toLatin1().constData()) ; - return true ; + aTypeString = QObject::tr( "GEOM_COMPOUNDSOLID" ); + break; } case TopAbs_SOLID: { - aTypeString = CORBA::string_dup(QObject::tr("GEOM_SOLID").toLatin1().constData()) ; - return true ; + aTypeString = QObject::tr( "GEOM_SOLID" ); + break; } case TopAbs_SHELL: { - aTypeString = CORBA::string_dup(QObject::tr("GEOM_SHELL").toLatin1().constData()) ; - return true ; + aTypeString = QObject::tr( "GEOM_SHELL" ); + break; } case TopAbs_FACE: { - BRepAdaptor_Surface surf(TopoDS::Face(aShape)); - if(surf.GetType() == GeomAbs_Plane) { - aTypeString = CORBA::string_dup(QObject::tr("GEOM_PLANE").toLatin1().constData()); - return true; - } - else if(surf.GetType() == GeomAbs_Cylinder) { - aTypeString = CORBA::string_dup(QObject::tr("GEOM_SURFCYLINDER").toLatin1().constData()); - return true; - } - else if(surf.GetType() == GeomAbs_Sphere) { - aTypeString = CORBA::string_dup(QObject::tr("GEOM_SURFSPHERE").toLatin1().constData()); - return true ; - } - else if(surf.GetType() == GeomAbs_Torus) { - aTypeString = CORBA::string_dup(QObject::tr("GEOM_SURFTORUS").toLatin1().constData()); - return true ; - } - else if(surf.GetType() == GeomAbs_Cone) { - aTypeString = CORBA::string_dup(QObject::tr("GEOM_SURFCONE").toLatin1().constData()); - return true ; - } - else { - aTypeString = CORBA::string_dup(QObject::tr("GEOM_FACE").toLatin1().constData()); - return true; - } + BRepAdaptor_Surface surf( TopoDS::Face( shape ) ); + switch ( surf.GetType() ) { + case GeomAbs_Plane: + { + aTypeString = QObject::tr( "GEOM_PLANE" ); + break; + } + case GeomAbs_Cylinder: + { + aTypeString = QObject::tr( "GEOM_SURFCYLINDER" ); + break; + } + case GeomAbs_Sphere: + { + aTypeString = QObject::tr( "GEOM_SURFSPHERE" ); + break; + } + case GeomAbs_Torus: + { + aTypeString = QObject::tr( "GEOM_SURFTORUS" ); + break; + } + case GeomAbs_Cone: + { + aTypeString = QObject::tr( "GEOM_SURFCONE" ); + break; + } + default: + { + aTypeString = QObject::tr( "GEOM_FACE" ); + break; + } + } + break; } case TopAbs_WIRE: { - aTypeString = CORBA::string_dup(QObject::tr("GEOM_WIRE").toLatin1().constData()); - return true; + aTypeString = QObject::tr( "GEOM_WIRE" ); + break; } case TopAbs_EDGE: { - BRepAdaptor_Curve curv(TopoDS::Edge(aShape)); - if(curv.GetType() == GeomAbs_Line) { - if((Abs(curv.FirstParameter()) >= 1E6) || (Abs(curv.LastParameter()) >= 1E6)) - aTypeString = CORBA::string_dup(QObject::tr("GEOM_LINE").toLatin1().constData()); - else - aTypeString = CORBA::string_dup(QObject::tr("GEOM_EDGE").toLatin1().constData()); - return true; - } - else if(curv.GetType() == GeomAbs_Circle) { - if(curv.IsClosed()) - aTypeString = CORBA::string_dup(QObject::tr("GEOM_CIRCLE").toLatin1().constData()); - else - aTypeString = CORBA::string_dup(QObject::tr("GEOM_ARC").toLatin1().constData()); - return true; - } - else { - aTypeString = CORBA::string_dup(QObject::tr("GEOM_EDGE").toLatin1().constData()); - return true; - } + BRepAdaptor_Curve curv( TopoDS::Edge( shape ) ); + switch ( curv.GetType() ) { + case GeomAbs_Line: + { + aTypeString = ( qAbs( curv.FirstParameter() ) >= 1E6 || qAbs( curv.LastParameter() ) >= 1E6 ) ? + QObject::tr( "GEOM_LINE" ) : QObject::tr( "GEOM_EDGE" ); + break; + } + case GeomAbs_Circle: + { + aTypeString = curv.IsClosed() ? QObject::tr( "GEOM_CIRCLE" ) : QObject::tr( "GEOM_ARC" ); + break; + } + default: + { + aTypeString = QObject::tr( "GEOM_EDGE" ); + break; + } + } + break; } case TopAbs_VERTEX: { - aTypeString = CORBA::string_dup(QObject::tr("GEOM_VERTEX").toLatin1().constData()); - return true; + aTypeString = QObject::tr( "GEOM_VERTEX" ); + break; } case TopAbs_SHAPE: { - aTypeString = CORBA::string_dup(QObject::tr("GEOM_SHAPE").toLatin1().constData()); - return true; + aTypeString = QObject::tr( "GEOM_SHAPE" ); + break; + } + default: + { + break; } } - return false; + } + return aTypeString; } @@ -296,54 +281,46 @@ bool GEOMBase::GetShapeTypeString(const TopoDS_Shape& aShape, Standard_CString& // function : ConvertIORinGEOMAISShape() // purpose : //======================================================================= -Handle(GEOM_AISShape) GEOMBase::ConvertIORinGEOMAISShape(const char * IOR, Standard_Boolean& testResult, bool onlyInActiveView) +Handle(GEOM_AISShape) GEOMBase::ConvertIORinGEOMAISShape(const QString& IOR, bool onlyInActiveView) { - Handle(GEOM_AISShape) resultShape; - testResult = false; - - SalomeApp_Study* appStudy = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); - if ( !appStudy ) return resultShape; - _PTR(Study) aStudy = appStudy->studyDS(); - - _PTR(SObject) anObj ( aStudy->FindObjectIOR( IOR ) ); - if ( !anObj ) - return resultShape; - - QList aViewWindowsList = SUIT_Session::session()->activeApplication()->desktop()->windows(); - - QListIterator it( aViewWindowsList ); - while ( it.hasNext() ) { - SUIT_ViewWindow* aVW = it.next(); - if (aVW && aVW->getViewManager()->getType() == OCCViewer_Viewer::Type()) { - Handle (AIS_InteractiveContext) ic = ((OCCViewer_Viewer*)aVW->getViewManager()->getViewModel())->getAISContext(); - - AIS_ListOfInteractive List; - ic->DisplayedObjects(List); - AIS_ListOfInteractive List1; - ic->ObjectsInCollector(List1); - List.Append(List1); - - AIS_ListIteratorOfListOfInteractive ite(List); - while(ite.More()) { - if(ite.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape))) { - Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite.Value()); - if(aSh->hasIO()) { - Handle(SALOME_InteractiveObject) GIO = Handle(SALOME_InteractiveObject)::DownCast(aSh->getIO()); - if(GIO->hasEntry() && strcmp(GIO->getEntry(), anObj->GetID().c_str()) == 0) { - if(!onlyInActiveView || - aVW == SUIT_Session::session()->activeApplication()->desktop()->activeWindow()) { - testResult = true; - resultShape = aSh; - return resultShape; - } - } - } - } - ite.Next(); + Handle(GEOM_AISShape) shape; + + SalomeApp_Study* study = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); + if ( study ) { + _PTR(Study) studyDS = study->studyDS(); + _PTR(SObject) obj( studyDS->FindObjectIOR( IOR.toLatin1().constData() ) ); + if ( obj ) { + QList views; + if ( onlyInActiveView ) + views.append( SUIT_Session::session()->activeApplication()->desktop()->activeWindow() ); + else + views = SUIT_Session::session()->activeApplication()->desktop()->windows(); + foreach ( SUIT_ViewWindow* view, views ) { + if ( view && view->getViewManager()->getType() == OCCViewer_Viewer::Type() ) { + Handle(AIS_InteractiveContext) ic = ((OCCViewer_Viewer*)view->getViewManager()->getViewModel())->getAISContext(); + + AIS_ListOfInteractive displayed; + ic->DisplayedObjects( displayed ); + ic->ObjectsInCollector( displayed ); + + AIS_ListIteratorOfListOfInteractive it( displayed ); + while ( it.More() && shape.IsNull() ) { + if ( it.Value()->IsInstance( STANDARD_TYPE(GEOM_AISShape) ) ) { + Handle(GEOM_AISShape) sh = Handle(GEOM_AISShape)::DownCast( it.Value() ); + if ( !sh.IsNull() && sh->hasIO() ) { + Handle(SALOME_InteractiveObject) IO = Handle(SALOME_InteractiveObject)::DownCast( sh->getIO() ); + if ( !IO.IsNull() && IO->hasEntry() && obj->GetID() == IO->getEntry() ) + shape = sh; + } + } + it.Next(); + } + } + if ( !shape.IsNull() ) break; } } } - return resultShape; + return shape; } @@ -351,96 +328,89 @@ Handle(GEOM_AISShape) GEOMBase::ConvertIORinGEOMAISShape(const char * IOR, Stand // function : ConvertIORinGEOMActor() // purpose : //======================================================================= -GEOM_Actor* GEOMBase::ConvertIORinGEOMActor(const char* IOR, Standard_Boolean& testResult, bool onlyInActiveView) +GEOM_Actor* GEOMBase::ConvertIORinGEOMActor(const QString& IOR, bool onlyInActiveView) { - testResult = false; - - SalomeApp_Study* appStudy = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); - if ( !appStudy ) return GEOM_Actor::New(); - _PTR(Study) aStudy = appStudy->studyDS(); - - _PTR(SObject) anObj ( aStudy->FindObjectIOR( IOR ) ); - if ( !anObj ) - return GEOM_Actor::New(); - - QList aViewWindowsList = SUIT_Session::session()->activeApplication()->desktop()->windows(); - - QListIterator it( aViewWindowsList ); - while ( it.hasNext() ) { - SUIT_ViewWindow* aVW = it.next(); - if (aVW && aVW->getViewManager()->getType() == SVTK_Viewer::Type()) { - SVTK_ViewWindow* aVTKViewWindow = dynamic_cast( aVW ); - if( !aVTKViewWindow ) - continue; - vtkRenderer* Renderer = aVTKViewWindow->getRenderer(); - vtkActorCollection* theActors = Renderer->GetActors(); - theActors->InitTraversal(); - vtkActor *ac = theActors->GetNextActor(); - while(!(ac==NULL)) { - if( ac->IsA("GEOM_Actor")) { - GEOM_Actor* anActor = GEOM_Actor::SafeDownCast(ac); - if(anActor->hasIO()) { - Handle(SALOME_InteractiveObject) GIO = Handle(SALOME_InteractiveObject)::DownCast(anActor->getIO()); - if(GIO->hasEntry() && strcmp(GIO->getEntry(), anObj->GetID().c_str()) == 0) { - if(!onlyInActiveView || - aVW == SUIT_Session::session()->activeApplication()->desktop()->activeWindow()) { - testResult = true; - return anActor; - } - } - } - } - ac = theActors->GetNextActor(); + GEOM_Actor* actor = 0; + + SalomeApp_Study* study = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); + if ( study ) { + _PTR(Study) studyDS = study->studyDS(); + _PTR(SObject) obj( studyDS->FindObjectIOR( IOR.toLatin1().constData() ) ); + if ( obj ) { + QList views; + if ( onlyInActiveView ) + views.append( SUIT_Session::session()->activeApplication()->desktop()->activeWindow() ); + else + views = SUIT_Session::session()->activeApplication()->desktop()->windows(); + foreach ( SUIT_ViewWindow* view, views ) { + if ( view && view->getViewManager()->getType() == SVTK_Viewer::Type() ) { + SVTK_ViewWindow* aVTKViewWindow = dynamic_cast( view ); + if( !aVTKViewWindow ) + continue; + vtkRenderer* Renderer = aVTKViewWindow->getRenderer(); + vtkActorCollection* theActors = Renderer->GetActors(); + theActors->InitTraversal(); + vtkActor* a = theActors->GetNextActor(); + while( a && !actor ) { + if ( a->IsA( "GEOM_Actor" ) ) { + GEOM_Actor* ga = GEOM_Actor::SafeDownCast( a ); + if ( ga && ga->hasIO() ) { + Handle(SALOME_InteractiveObject) IO = Handle(SALOME_InteractiveObject)::DownCast( ga->getIO() ); + if ( !IO.IsNull() && IO->hasEntry() && obj->GetID() == IO->getEntry() ) + actor = ga; + } + } + a = theActors->GetNextActor(); + } + } + if ( actor ) break; } } } - testResult = false; - return GEOM_Actor::New(); + return actor; } //======================================================================= // function : GetAIS() // purpose : //======================================================================= -Handle(AIS_InteractiveObject) GEOMBase::GetAIS( const Handle(SALOME_InteractiveObject)& theIO, - const bool isOnlyInActiveView ) +Handle(AIS_InteractiveObject) GEOMBase::GetAIS( const Handle(SALOME_InteractiveObject)& IO, + bool onlyInActiveView, bool onlyGeom ) { - if ( theIO.IsNull() || !theIO->hasEntry() ) - return Handle(AIS_InteractiveObject)(); - - QList aViewWindowsList = SUIT_Session::session()->activeApplication()->desktop()->windows(); - - QListIterator it( aViewWindowsList ); - while ( it.hasNext() ) { - SUIT_ViewWindow* aVW = it.next(); - if (!aVW || aVW->getViewManager()->getType() != OCCViewer_Viewer::Type()) - continue; - Handle (AIS_InteractiveContext) anIC = ((OCCViewer_Viewer*)aVW->getViewManager()->getViewModel())->getAISContext(); - - AIS_ListOfInteractive aList; - anIC->DisplayedObjects( aList ); - anIC->ObjectsInCollector( aList ); - - AIS_ListIteratorOfListOfInteractive anIter( aList ); - for ( ; anIter.More(); anIter.Next() ) - { - Handle(SALOME_InteractiveObject) anObj = - Handle(SALOME_InteractiveObject)::DownCast( anIter.Value()->GetOwner() ); - - if( !anObj.IsNull() && strcmp( anObj->getEntry(), theIO->getEntry() ) == 0 ) - { - if( isOnlyInActiveView ) - { - if ( aVW == SUIT_Session::session()->activeApplication()->desktop()->activeWindow() ) - return anIter.Value(); - } - else - return anIter.Value(); + Handle(AIS_InteractiveObject) aisObject; + + if ( !IO.IsNull() && IO->hasEntry() ) { + QList views; + if ( onlyInActiveView ) + views.append( SUIT_Session::session()->activeApplication()->desktop()->activeWindow() ); + else + views = SUIT_Session::session()->activeApplication()->desktop()->windows(); + + foreach ( SUIT_ViewWindow* view, views ) { + if ( view && view->getViewManager()->getType() == OCCViewer_Viewer::Type() ) { + Handle(AIS_InteractiveContext) anIC = ((OCCViewer_Viewer*)view->getViewManager()->getViewModel())->getAISContext(); + + AIS_ListOfInteractive displayed; + anIC->DisplayedObjects( displayed ); + anIC->ObjectsInCollector( displayed ); + + AIS_ListIteratorOfListOfInteractive it( displayed ); + while ( it.More() && aisObject.IsNull() ) { + if ( onlyGeom && !it.Value()->IsInstance( STANDARD_TYPE(GEOM_AISShape) ) ) + continue; + + Handle(SALOME_InteractiveObject) obj = + Handle(SALOME_InteractiveObject)::DownCast( it.Value()->GetOwner() ); + + if ( !obj.IsNull() && obj->isSame( IO ) ) + aisObject = it.Value(); + } } + if ( !aisObject.IsNull() ) break; } } - return Handle(AIS_InteractiveObject)(); + return aisObject; } @@ -448,246 +418,129 @@ Handle(AIS_InteractiveObject) GEOMBase::GetAIS( const Handle(SALOME_InteractiveO // function : ConvertIOinGEOMAISShape() // purpose : //======================================================================= -Handle(GEOM_AISShape) GEOMBase::ConvertIOinGEOMAISShape(const Handle(SALOME_InteractiveObject)& IO, Standard_Boolean& testResult, bool onlyInActiveView) +Handle(GEOM_AISShape) GEOMBase::ConvertIOinGEOMAISShape( const Handle(SALOME_InteractiveObject)& IO, bool onlyInActiveView ) { - Handle(GEOM_AISShape) res; - - if ( !IO->hasEntry() ) - { - testResult = false; - return res; - } - - QList aViewWindowsList = SUIT_Session::session()->activeApplication()->desktop()->windows(); - - QListIterator it( aViewWindowsList ); - while ( it.hasNext() ) { - SUIT_ViewWindow* aVW = it.next(); - if (aVW && aVW->getViewManager()->getType() == OCCViewer_Viewer::Type()) { - Handle (AIS_InteractiveContext) ic = ((OCCViewer_Viewer*)aVW->getViewManager()->getViewModel())->getAISContext(); - - AIS_ListOfInteractive List; - ic->DisplayedObjects(List); - AIS_ListOfInteractive List1; - ic->ObjectsInCollector(List1); - List.Append(List1); - - AIS_ListIteratorOfListOfInteractive ite(List); - while(ite.More()) - { - if(ite.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape))) - { - Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite.Value()); - if( aSh->hasIO() ) - { - if( strcmp( aSh->getIO()->getEntry(), IO->getEntry() ) == 0 ) - { - if(onlyInActiveView) - { - if(aVW == SUIT_Session::session()->activeApplication()->desktop()->activeWindow()) - { - testResult = true; - return aSh; - } - } - else - { - testResult = true; - return aSh; - } - } - } - } - ite.Next(); - } - } - } - testResult = false; - return res; + return Handle(GEOM_AISShape)::DownCast( GetAIS( IO, onlyInActiveView, true ) ); } //======================================================================= -// function : ConvertIOinGEOMShape() +// function : ConvertListOfIOInListOfIOR() // purpose : //======================================================================= -GEOM::GEOM_Object_ptr GEOMBase::ConvertIOinGEOMShape(const Handle(SALOME_InteractiveObject)& IO, - Standard_Boolean& testResult) +QStringList GEOMBase::ConvertListOfIOInListOfIOR( const SALOME_ListIO& IObjects ) { - GEOM::GEOM_Object_var aShape; - testResult = false; - - /* case SObject */ - if(IO->hasEntry()) { - SalomeApp_Study* appStudy = dynamic_cast - (SUIT_Session::session()->activeApplication()->activeStudy()); - if ( !appStudy ) return GEOM::GEOM_Object::_nil(); - _PTR(Study) aStudy = appStudy->studyDS(); - - _PTR(SObject) obj ( aStudy->FindObjectID(IO->getEntry()) ); - _PTR(GenericAttribute) anAttr; - if(obj) { - if(obj->FindAttribute(anAttr, "AttributeIOR")) { - _PTR(AttributeIOR) anIOR ( anAttr ); - aShape = GeometryGUI::GetGeomGen()->GetIORFromString(anIOR->Value().c_str()); - if(!CORBA::is_nil(aShape)) - testResult = true; - return aShape._retn(); - } + QStringList iors; + SALOME_ListIteratorOfListIO it( IObjects ); + SalomeApp_Study* study = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); + if ( study ) { + _PTR(Study) studyDS = study->studyDS(); + for ( ; it.More(); it.Next() ) { + GEOM::GEOM_Object_var geomObj = ConvertIOinGEOMObject( it.Value() ); + if ( !CORBA::is_nil( geomObj ) ) + iors.append( GetIORFromObject( geomObj ) ); } } - return GEOM::GEOM_Object::_nil(); + return iors; } //======================================================================= -// function : ConvertListOfIOInListOfIOR() +// function : ConvertIOinGEOMObject() // purpose : //======================================================================= -void GEOMBase::ConvertListOfIOInListOfIOR(const SALOME_ListIO& aList, GEOM::string_array& listIOR) +GEOM::GEOM_Object_ptr GEOMBase::ConvertIOinGEOMObject( const Handle(SALOME_InteractiveObject)& IO ) { - int nbSel = aList.Extent(); - listIOR.length(nbSel); - int j=0; - SALOME_ListIteratorOfListIO It(aList); - SalomeApp_Study* appStudy = dynamic_cast - ( SUIT_Session::session()->activeApplication()->activeStudy() ); - if ( !appStudy ) return; - _PTR(Study) aStudy = appStudy->studyDS(); - - for (int i=0; It.More(); It.Next(), i++) { - Handle(SALOME_InteractiveObject) IObject = It.Value(); - if (IObject->hasEntry()) { - _PTR(SObject) obj ( aStudy->FindObjectID(IObject->getEntry()) ); - _PTR(GenericAttribute) anAttr; - if (obj && obj->FindAttribute(anAttr, "AttributeIOR")) { - _PTR(AttributeIOR) anIOR (anAttr); - //CORBA::Object_var theObj = dynamic_cast - // (aStudy.get())->ConvertIORToObject(anIOR->Value()); - CORBA::Object_var theObj = GeometryGUI::ClientSObjectToObject(obj); - if (!CORBA::is_nil(theObj) && theObj->_is_a("IDL:GEOM/GEOM_Object:1.0")) { - listIOR[j] = CORBA::string_dup(anIOR->Value().c_str()); - j++; - } + GEOM::GEOM_Object_var object; + + if ( !IO.IsNull() && IO->hasEntry() ) { + SalomeApp_Study* study = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); + if ( study ) { + _PTR(Study) studyDS = study->studyDS(); + _PTR(SObject) obj( studyDS->FindObjectID( IO->getEntry() ) ); + if ( obj ) { + CORBA::Object_var corbaObj = GeometryGUI::ClientSObjectToObject( obj ); + if ( !CORBA::is_nil( corbaObj ) ) + object = GEOM::GEOM_Object::_narrow( corbaObj ); } } } - listIOR.length(j); + return object._retn(); } //======================================================================= -// function : ConvertIOinGEOMObject() +// function : ConvertListOfIOInListOfGO() // purpose : //======================================================================= -GEOM::GEOM_Object_ptr GEOMBase::ConvertIOinGEOMObject (const Handle(SALOME_InteractiveObject)& theIO, - Standard_Boolean& theResult) +void GEOMBase::ConvertListOfIOInListOfGO( const SALOME_ListIO& IObjects, + GEOM::ListOfGO& geomObjects, + bool shapesOnly ) { - theResult = Standard_False; - GEOM::GEOM_Object_var aReturnObject; - - if (!theIO.IsNull()) - { - const char* anEntry = theIO->getEntry(); + geomObjects.length( 0 ); - SalomeApp_Study* appStudy = dynamic_cast - (SUIT_Session::session()->activeApplication()->activeStudy()); - if (!appStudy) return GEOM::GEOM_Object::_nil(); - _PTR(Study) aStudy = appStudy->studyDS(); + SalomeApp_Study* study = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); + if ( study ) { + _PTR(Study) studyDS = study->studyDS(); - _PTR(SObject) aSObj (aStudy->FindObjectID(anEntry)); + geomObjects.length( IObjects.Extent() ); + SALOME_ListIteratorOfListIO it( IObjects ); - if (aSObj) - { - aReturnObject = GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aSObj)); - theResult = !CORBA::is_nil(aReturnObject); + int i = 0; + for ( ; it.More(); it.Next() ) { + GEOM::GEOM_Object_var geomObj = ConvertIOinGEOMObject( it.Value() ); + if ( !CORBA::is_nil( geomObj ) && ( !shapesOnly || IsShape( geomObj ) ) ) + geomObjects[ i++ ] = geomObj; } + geomObjects.length( i ); } - return aReturnObject._retn(); } -//======================================================================= -// function : ConvertListOfIOInListOfGO() -// purpose : -//======================================================================= -void GEOMBase::ConvertListOfIOInListOfGO( const SALOME_ListIO& theList, - GEOM::ListOfGO& theListGO, - const bool theShapesOnly ) -{ - int nbSel = theList.Extent(); - theListGO.length( nbSel ); - SALOME_ListIteratorOfListIO anIter( theList ); - - SalomeApp_Study* appStudy = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); - if ( !appStudy ) return; - _PTR(Study) aStudy = appStudy->studyDS(); - - int j = 0; - for ( int i=0; anIter.More(); anIter.Next(), i++ ) - { - Handle(SALOME_InteractiveObject) anIObj = anIter.Value(); - _PTR(SObject) aSObj ( aStudy->FindObjectID( anIObj->getEntry() ) ); - - if ( aSObj ) - { - GEOM::GEOM_Object_var aGeomObj = - GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aSObj)); - if ( !CORBA::is_nil( aGeomObj ) && ( !theShapesOnly || IsShape( aGeomObj ) ) ) - theListGO[ j++ ] = aGeomObj; - } - } - - theListGO.length( j ); -} - //================================================================================= // function : CreateArrowForLinearEdge() // purpose : Create a cone topology to be used to display an arrow in the middle // : of an edge showing its orientation. (For simulation and Viewer OCC only) //================================================================================= -bool GEOMBase::CreateArrowForLinearEdge(const TopoDS_Shape& tds, TopoDS_Shape& ArrowCone) +TopoDS_Shape GEOMBase::CreateArrowForLinearEdge( const TopoDS_Shape& shape ) { - if(SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()->getType() - != OCCViewer_Viewer::Type() || tds.ShapeType() != TopAbs_EDGE) - return false; - - OCCViewer_ViewPort3d* vp3d = ((OCCViewer_ViewWindow*)SUIT_Session::session()->activeApplication()->desktop()->activeWindow())->getViewPort(); - Handle( V3d_View) view3d = vp3d->getView(); - Standard_Real Width, Height; - view3d->Size(Width, Height); - const Standard_Real aHeight = (Width + Height) / 50.0; - - try { - Standard_Real first, last; - Handle(Geom_Curve) curv = BRep_Tool::Curve(TopoDS::Edge(tds), first, last); - if(!curv->IsCN(1)) - return false; - - const Standard_Real param = (first+last) / 2.0; - gp_Pnt middleParamPoint; - gp_Vec V1; - curv->D1( param, middleParamPoint, V1); - if(V1.Magnitude() < Precision::Confusion()) - return false; - - /* Topology orientation not geom orientation */ - if(tds.Orientation() == TopAbs_REVERSED) - V1 *= -1.0; - - gp_Ax2 anAxis( middleParamPoint, gp_Dir(V1)); - const Standard_Real radius1 = aHeight / 5.0; - if(radius1 > 10.0 * Precision::Confusion() && aHeight > 10.0 * Precision::Confusion()) { - ArrowCone = BRepPrimAPI_MakeCone( anAxis, radius1, 0.0, aHeight ).Shape(); - return true; + TopoDS_Shape ArrowCone; + + SUIT_ViewWindow* view = SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); + if ( view && view->getViewManager()->getType() == OCCViewer_Viewer::Type() && shape.ShapeType() == TopAbs_EDGE ) { + Handle(V3d_View) view3d = ((OCCViewer_ViewWindow*)view)->getViewPort()->getView(); + Standard_Real Width, Height; + view3d->Size( Width, Height ); + const Standard_Real aHeight = (Width + Height) / 50.0; + + try { + Standard_Real first, last; + Handle(Geom_Curve) curv = BRep_Tool::Curve( TopoDS::Edge( shape ), first, last ); + if ( curv->IsCN(1) ) { + const Standard_Real param = ( first+last ) / 2.0; + gp_Pnt middleParamPoint; + gp_Vec V1; + curv->D1( param, middleParamPoint, V1 ); + if ( V1.Magnitude() > Precision::Confusion() ) { + /* Topology orientation not geom orientation */ + if ( shape.Orientation() == TopAbs_REVERSED ) + V1 *= -1.0; + + gp_Ax2 anAxis( middleParamPoint, gp_Dir( V1 ) ); + const Standard_Real radius1 = aHeight / 5.0; + if ( radius1 > 10.0 * Precision::Confusion() && aHeight > 10.0 * Precision::Confusion() ) + ArrowCone = BRepPrimAPI_MakeCone( anAxis, radius1, 0.0, aHeight ).Shape(); + } + } + } + catch ( Standard_Failure ) { + // OCC failures are hard to catch in GUI. + // This is because of the position for #include that is very critical to find + // in SALOME environment : compilation error ! } } - catch(Standard_Failure) { - // OCC failures are hard to catch in GUI. - // This because of the position for #include that is very critic to find - // in SALOME environment : compilation error ! - } - return false; + + return ArrowCone; } @@ -695,11 +548,11 @@ bool GEOMBase::CreateArrowForLinearEdge(const TopoDS_Shape& tds, TopoDS_Shape& A // function : VertexToPoint() // purpose : If S can be converted in a gp_Pnt returns true and the result is P //================================================================================= -bool GEOMBase::VertexToPoint(const TopoDS_Shape& S, gp_Pnt& P) +bool GEOMBase::VertexToPoint( const TopoDS_Shape& shape, gp_Pnt& point ) { - if(S.IsNull() || S.ShapeType() != TopAbs_VERTEX) + if ( shape.IsNull() || shape.ShapeType() != TopAbs_VERTEX ) return false; - P = BRep_Tool::Pnt(TopoDS::Vertex(S)); + point = BRep_Tool::Pnt( TopoDS::Vertex( shape ) ); return true; } @@ -708,12 +561,11 @@ bool GEOMBase::VertexToPoint(const TopoDS_Shape& S, gp_Pnt& P) // function : GetBipointDxDyDz() // purpose : //================================================================================= -void GEOMBase::GetBipointDxDyDz(gp_Pnt P1, gp_Pnt P2, double& dx, double& dy, double& dz) +void GEOMBase::GetBipointDxDyDz( const gp_Pnt& point1, const gp_Pnt& point2, double& dx, double& dy, double& dz ) { - dx = P2.X() - P1.X(); - dy = P2.Y() - P1.Y(); - dz = P2.Z() - P1.Z(); - return; + dx = point2.X() - point1.X(); + dy = point2.Y() - point1.Y(); + dz = point2.Z() - point1.Z(); } @@ -723,20 +575,25 @@ void GEOMBase::GetBipointDxDyDz(gp_Pnt P1, gp_Pnt P2, double& dx, double& dy, do // : distance is sufficient, returns true else returns false. // : Resulting points are respectively P1 and P2 //================================================================================= -bool GEOMBase::LinearEdgeExtremities(const TopoDS_Shape& S, gp_Pnt& P1, gp_Pnt& P2) +bool GEOMBase::LinearEdgeExtremities( const TopoDS_Shape& shape, gp_Pnt& point1, gp_Pnt& point2 ) { - if(S.IsNull() || S.ShapeType() != TopAbs_EDGE) + if ( shape.IsNull() || shape.ShapeType() != TopAbs_EDGE ) return false; - BRepAdaptor_Curve curv(TopoDS::Edge(S)); - if(curv.GetType() != GeomAbs_Line) + + BRepAdaptor_Curve curv( TopoDS::Edge( shape ) ); + if ( curv.GetType() != GeomAbs_Line ) return false; + + gp_Pnt p1, p2; - curv.D0(curv.FirstParameter(), P1); - curv.D0(curv.LastParameter(), P2); + curv.D0( curv.FirstParameter(), p1 ); + curv.D0( curv.LastParameter(), p2 ); - if(P1.Distance(P2) <= Precision::Confusion()) + if ( p1.Distance( p2 ) <= Precision::Confusion() ) return false; + point1 = p1; + point2 = p2; return true; } @@ -747,38 +604,36 @@ bool GEOMBase::LinearEdgeExtremities(const TopoDS_Shape& S, gp_Pnt& P1, gp_Pnt& // : The selection is changed. Dialog box will receive the // : corresponding signal to manage this event. //======================================================================= -bool GEOMBase::SelectionByNameInDialogs(QWidget* aWidget, const QString& objectUserName, const SALOME_ListIO& aList) +bool GEOMBase::SelectionByNameInDialogs( QWidget* widget, const QString& objectUserName, const SALOME_ListIO& /*IObjects*/ ) { /* Find SObject with name in component GEOM */ - SalomeApp_Study* appStudy = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); - if ( !appStudy ) return false; - _PTR(Study) ST = appStudy->studyDS(); - - std::vector<_PTR(SObject)> listSO; - listSO = ST->FindObjectByName(objectUserName.toStdString(), "GEOM"); - - if(listSO.size() < 1) { - const QString caption = QObject::tr("GEOM_WRN_WARNING"); - const QString text = QObject::tr("GEOM_NAME_INCORRECT"); - const QString button0 = QObject::tr("GEOM_BUT_OK"); - SUIT_MessageBox::critical(aWidget, caption, text, button0); + SalomeApp_Study* study = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); + if ( !study ) return false; + _PTR(Study) studyDS = study->studyDS(); + + std::vector<_PTR(SObject)> listSO = studyDS->FindObjectByName( objectUserName.toStdString(), "GEOM" ); + + if ( listSO.size() < 1 ) { + SUIT_MessageBox::critical( widget, + QObject::tr( "GEOM_WRN_WARNING" ), + QObject::tr( "GEOM_NAME_INCORRECT" ), + QObject::tr( "GEOM_BUT_OK" ) ); return false; } + /* More than one object with same name */ - if(listSO.size() > 1) { - const QString caption = QObject::tr("GEOM_WRN_WARNING"); - const QString text = QObject::tr("GEOM_IDENTICAL_NAMES_SELECT_BY_MOUSE"); - const QString button0 = QObject::tr("GEOM_BUT_OK") ; - SUIT_MessageBox::critical(aWidget, caption, text, button0) ; - listSO.clear(); + if ( listSO.size() > 1 ) { + SUIT_MessageBox::critical( widget, + QObject::tr("GEOM_WRN_WARNING"), + QObject::tr("GEOM_IDENTICAL_NAMES_SELECT_BY_MOUSE"), + QObject::tr("GEOM_BUT_OK") ); return false; } - _PTR(SObject) theObj ( listSO[0] ); /* Create a SALOME_InteractiveObject with a SALOME::SObject */ - char* aCopyobjectUserName = CORBA::string_dup(objectUserName.toLatin1().constData()); - Handle(SALOME_InteractiveObject) SI = new SALOME_InteractiveObject(theObj->GetID().c_str(), "GEOM", aCopyobjectUserName); - delete(aCopyobjectUserName); + Handle(SALOME_InteractiveObject) IO = new SALOME_InteractiveObject( listSO[0]->GetID().c_str(), + "GEOM", + objectUserName.toLatin1().constData() ); /* Add as a selected object */ /* Clear any previous selection : */ @@ -793,13 +648,12 @@ bool GEOMBase::SelectionByNameInDialogs(QWidget* aWidget, const QString& objectU // function : DefineDlgPosition() // purpose : Define x and y the default position for a dialog box //======================================================================= -bool GEOMBase::DefineDlgPosition(QWidget* aDlg, int& x, int& y) +void GEOMBase::DefineDlgPosition( QWidget* dlg, int& x, int& y ) { /* Here the position is on the bottom right corner - 10 */ - SUIT_Desktop* PP = SUIT_Session::session()->activeApplication()->desktop(); - x = abs(PP->x() + PP->size().width() - aDlg->size().width() - 10); - y = abs(PP->y() + PP->size().height() - aDlg->size().height() - 10); - return true; + SUIT_Desktop* d = SUIT_Session::session()->activeApplication()->desktop(); + x = abs( d->x() + d->size().width() - dlg->size().width() - 10 ); + y = abs( d->y() + d->size().height() - dlg->size().height() - 10 ); } @@ -807,50 +661,47 @@ bool GEOMBase::DefineDlgPosition(QWidget* aDlg, int& x, int& y) // function : GetDefaultName() // purpose : Generates default names //======================================================================= -QString GEOMBase::GetDefaultName(const QString& theOperation, const bool extractPrefix) +QString GEOMBase::GetDefaultName( const QString& operation, bool extractPrefix ) { QString aName = ""; // collect all object names of GEOM component - SalomeApp_Study* appStudy = - dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); - if ( !appStudy ) return aName; - _PTR(Study) aStudy = appStudy->studyDS(); - - std::set aSet; - _PTR(SComponent) aGeomCompo (aStudy->FindComponent("GEOM")); - if (aGeomCompo) { - _PTR(ChildIterator) it (aStudy->NewChildIterator(aGeomCompo)); - _PTR(SObject) obj; - for (it->InitEx(true); it->More(); it->Next()) { - obj = it->Value(); - aSet.insert(obj->GetName()); + SalomeApp_Study* study = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); + if ( study ) { + _PTR(Study) studyDS = study->studyDS(); + + std::set names; + _PTR(SComponent) component( studyDS->FindComponent( "GEOM" ) ); + if ( component ) { + _PTR(ChildIterator) it( studyDS->NewChildIterator( component ) ); + for ( it->InitEx( true ); it->More(); it->Next() ) { + names.insert( it->Value()->GetName() ); + } } - } - // build a unique name - int aNumber = 0; - bool isUnique = false; - QString prefix = theOperation; - - if ( extractPrefix ) { - QStringList parts = prefix.split( "_", QString::KeepEmptyParts ); - if ( parts.count() > 1 ) { - bool ok; - aNumber = parts.last().toLong(&ok); - if ( ok ) { - parts.removeLast(); - prefix = parts.join( "_" ); - aNumber--; + // build a unique name + int aNumber = 0; + bool isUnique = false; + QString prefix = operation; + + if ( extractPrefix ) { + QStringList parts = prefix.split( "_", QString::KeepEmptyParts ); + if ( parts.count() > 1 ) { + bool ok; + aNumber = parts.last().toLong( &ok ); + if ( ok ) { + parts.removeLast(); + prefix = parts.join( "_" ); + aNumber--; + } } } + + while ( !isUnique ) { + aName = prefix + "_" + QString::number( ++aNumber ); + isUnique = ( names.count( aName.toStdString()) == 0 ); + } } - - while (!isUnique) { - aName = prefix + "_" + QString::number(++aNumber); - isUnique = (aSet.count(aName.toStdString()) == 0); - } - return aName; } @@ -859,19 +710,19 @@ QString GEOMBase::GetDefaultName(const QString& theOperation, const bool extract // function : ShowErrorMessage() // purpose : Shows message box with error code and comment //======================================================================= -void GEOMBase::ShowErrorMessage(const char* theErrorCode, const char* theComment) +void GEOMBase::ShowErrorMessage( const QString& errorCode, const QString& comment ) { - QString anErrorCode(theErrorCode); - QString aComment(theComment); - - QString aText = ""; - if (!anErrorCode.isEmpty()) - aText.append("\n" + QObject::tr(anErrorCode.toLatin1().constData())); - if (!aComment.isEmpty()) - aText.append("\n" + QString(theComment)); - - SUIT_MessageBox::critical( SUIT_Session::session()->activeApplication()->desktop(), QObject::tr( "GEOM_ERROR" ), - QObject::tr("GEOM_PRP_ABORT") + aText, "OK" ); + QStringList text; + text << QObject::tr( "GEOM_PRP_ABORT" ); + if ( !errorCode.isEmpty() ) + text << QObject::tr( errorCode.toLatin1().constData() ); + if ( !comment.isEmpty() ) + text << QObject::tr( comment.toLatin1().constData() ); + + SUIT_MessageBox::critical( SUIT_Session::session()->activeApplication()->desktop(), + QObject::tr( "GEOM_ERROR" ), + text.join( "\n" ), + QObject::tr( "GEOM_BUT_OK" ) ); } @@ -879,75 +730,72 @@ void GEOMBase::ShowErrorMessage(const char* theErrorCode, const char* theComment // function : GetObjectFromIOR() // purpose : returns a GEOM_Object by given IOR (string) //======================================================================= -GEOM::GEOM_Object_ptr GEOMBase::GetObjectFromIOR( const char* theIOR ) +GEOM::GEOM_Object_ptr GEOMBase::GetObjectFromIOR( const QString& IOR ) { - GEOM::GEOM_Object_var anObject; - if ( theIOR == NULL || strlen( theIOR ) == 0 ) - return anObject._retn(); // returning nil object - - anObject = GEOM::GEOM_Object::_narrow( SalomeApp_Application::orb()->string_to_object( theIOR ) ); - return anObject._retn(); + GEOM::GEOM_Object_var geomObj; + if ( !IOR.isEmpty() ) { + CORBA::Object_var corbaObj = SalomeApp_Application::orb()->string_to_object( IOR.toLatin1().constData() ); + if ( !CORBA::is_nil( corbaObj ) ) + geomObj = GEOM::GEOM_Object::_narrow( corbaObj ); + } + return geomObj._retn(); } //======================================================================= // function : GetIORFromObject() // purpose : returns IOR of a given GEOM_Object //======================================================================= -QString GEOMBase::GetIORFromObject( const GEOM::GEOM_Object_ptr& theObject ) +QString GEOMBase::GetIORFromObject( GEOM::GEOM_Object_ptr object ) { - if ( CORBA::is_nil( theObject ) ) - return NULL; - - return SalomeApp_Application::orb()->object_to_string( theObject ); + QString IOR; + if ( !CORBA::is_nil( object ) ) { + CORBA::String_var anIOR = SalomeApp_Application::orb()->object_to_string( object ); + IOR = anIOR.in(); + } + return IOR; } //======================================================================= // function : GetShape() // purpose : returns a TopoDS_Shape stored in GEOM_Object //======================================================================= -bool GEOMBase::GetShape( const GEOM::GEOM_Object_ptr& theObject, TopoDS_Shape& theShape, const TopAbs_ShapeEnum theType ) +bool GEOMBase::GetShape( GEOM::GEOM_Object_ptr object, TopoDS_Shape& shape, const TopAbs_ShapeEnum type ) { - if ( !CORBA::is_nil( theObject ) ) - { - TopoDS_Shape aTopoDSShape = GEOM_Client::get_client().GetShape( GeometryGUI::GetGeomGen(), theObject ); - if ( !aTopoDSShape.IsNull() && ( theType == TopAbs_SHAPE || theType == aTopoDSShape.ShapeType() ) ) - { - theShape = aTopoDSShape; - return true; - } + shape = TopoDS_Shape(); + if ( !CORBA::is_nil( object ) ) { + TopAbs_ShapeEnum stype = (TopAbs_ShapeEnum)( object->GetShapeType() ); + if ( type == TopAbs_SHAPE || type == stype ) + shape = GEOM_Client::get_client().GetShape( GeometryGUI::GetGeomGen(), object ); } - return false; + return !shape.IsNull(); } //======================================================================= // function : GetName() // purpose : Get name of object //======================================================================= -QString GEOMBase::GetName( GEOM::GEOM_Object_ptr theObj ) +QString GEOMBase::GetName( GEOM::GEOM_Object_ptr object ) { - SalomeApp_Study* appStudy = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); - - if ( appStudy ) - { - CORBA::String_var anIOR = SalomeApp_Application::orb()->object_to_string( theObj ); - if ( strcmp(anIOR.in(), "") != 0 ) - { - _PTR(SObject) aSObj ( appStudy->studyDS()->FindObjectIOR( std::string( anIOR ) ) ); - - _PTR(GenericAttribute) anAttr; - - if ( aSObj && aSObj->FindAttribute( anAttr, "AttributeName") ) - { - _PTR(AttributeName) aNameAttr ( anAttr ); - return QString( aNameAttr->Value().c_str() ); - } + QString name; + SalomeApp_Study* study = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); + CORBA::String_var IOR = SalomeApp_Application::orb()->object_to_string( object ); + if ( study && strcmp( IOR.in(), "" ) != 0 ) { + _PTR(SObject) aSObj( study->studyDS()->FindObjectIOR( std::string( IOR.in() ) ) ); + _PTR(GenericAttribute) anAttr; + if ( aSObj && aSObj->FindAttribute( anAttr, "AttributeName") ) { + _PTR(AttributeName) aNameAttr( anAttr ); + name = aNameAttr->Value().c_str(); } } - return QString(""); + return name; } -bool GEOMBase::IsShape( GEOM::GEOM_Object_ptr theObj ) +//======================================================================= +// function : IsShape() +// purpose : Return TRUE if object is valid and has shape +//======================================================================= +bool GEOMBase::IsShape( GEOM::GEOM_Object_ptr object ) { - return !theObj->_is_nil() && theObj->IsShape(); + return !object->_is_nil() && object->IsShape(); } diff --git a/src/GEOMBase/GEOMBase.h b/src/GEOMBase/GEOMBase.h index fb846fe3c..cce06e658 100644 --- a/src/GEOMBase/GEOMBase.h +++ b/src/GEOMBase/GEOMBase.h @@ -54,70 +54,75 @@ class GEOMBASE_EXPORT GEOMBase { public : /* Selection and objects management */ - static int GetIndex(const TopoDS_Shape& subshape, const TopoDS_Shape& shape, int ShapeType); - static TopoDS_Shape GetShapeFromIOR(QString IOR); - static bool GetShape(const GEOM::GEOM_Object_ptr&, TopoDS_Shape&, - const TopAbs_ShapeEnum = TopAbs_SHAPE); - static bool GetTopoFromSelection(const SALOME_ListIO& aList, TopoDS_Shape& tds); - static int GetNameOfSelectedIObjects(const SALOME_ListIO& aList, QString& aName, - const bool theShapesOnly = false); - static bool GetShapeTypeString(const TopoDS_Shape& aShape, Standard_CString& aTypeString); + static int GetIndex( const TopoDS_Shape& subshape, const TopoDS_Shape& shape ); + static TopoDS_Shape GetShapeFromIOR( const QString& IOR ); + static bool GetShape( GEOM::GEOM_Object_ptr object, + TopoDS_Shape& shape, + const TopAbs_ShapeEnum type = TopAbs_SHAPE ); + static TopoDS_Shape GetTopoFromSelection( const SALOME_ListIO& IObjects ); + static int GetNameOfSelectedIObjects( const SALOME_ListIO& IObjects, + QString& name, + const bool shapesOnly = false ); + static QString GetShapeTypeString( const TopoDS_Shape& shape ); /* Convertions */ - static GEOM::GEOM_Object_ptr ConvertIOinGEOMShape(const Handle(SALOME_InteractiveObject)& IO, - Standard_Boolean& testResult); - static Handle(GEOM_AISShape) ConvertIOinGEOMAISShape(const Handle(SALOME_InteractiveObject)& IO, - Standard_Boolean& testResult, - bool onlyInActiveView = false); + static Handle(GEOM_AISShape) + ConvertIOinGEOMAISShape( const Handle(SALOME_InteractiveObject)& IO, + bool onlyInActiveView = false ); - static Handle(AIS_InteractiveObject) GetAIS(const Handle(SALOME_InteractiveObject)& theIO, - const bool isOnlyInActiveView = false); - static void ConvertListOfIOInListOfIOR(const SALOME_ListIO& aList, - GEOM::string_array& listIOR); + static Handle(AIS_InteractiveObject) + GetAIS( const Handle(SALOME_InteractiveObject)& IO, + bool onlyInActiveView = false, + bool onlyGeom = false ); + static QStringList ConvertListOfIOInListOfIOR( const SALOME_ListIO& IObjects ); - static Handle(GEOM_AISShape) ConvertIORinGEOMAISShape(const char * IOR, - Standard_Boolean& testResult, - bool onlyInActiveView = false); - static GEOM_Actor* ConvertIORinGEOMActor(const char * IOR, Standard_Boolean& testResult, - bool onlyInActiveView = false); + static Handle(GEOM_AISShape) + ConvertIORinGEOMAISShape( const QString& IOR, + bool onlyInActiveView = false ); + static GEOM_Actor* ConvertIORinGEOMActor( const QString& IOR, + bool onlyInActiveView = false ); - static GEOM::GEOM_Object_ptr ConvertIOinGEOMObject(const Handle(SALOME_InteractiveObject)& IO, - Standard_Boolean& testResult); + static GEOM::GEOM_Object_ptr + ConvertIOinGEOMObject( const Handle(SALOME_InteractiveObject)& IO ); - static void ConvertListOfIOInListOfGO(const SALOME_ListIO& aList, - GEOM::ListOfGO& listGO, - const bool theShapesOnly = false); + static void ConvertListOfIOInListOfGO( const SALOME_ListIO& IObjects, + GEOM::ListOfGO& geomObjects, + bool shapesOnly = false ); - static GEOM::GEOM_Object_ptr GetObjectFromIOR(const char* theIOR); + static GEOM::GEOM_Object_ptr + GetObjectFromIOR( const QString& IOR ); - static QString GetIORFromObject(const GEOM::GEOM_Object_ptr& theObject); + static QString GetIORFromObject( GEOM::GEOM_Object_ptr object ); /* Geometry */ - static bool VertexToPoint(const TopoDS_Shape& S, gp_Pnt& P); + static bool VertexToPoint( const TopoDS_Shape& shape, gp_Pnt& point ); /* Used just by Plane and Prism */ - static bool LinearEdgeExtremities(const TopoDS_Shape& S, gp_Pnt& P1, gp_Pnt& P2); - static void GetBipointDxDyDz(gp_Pnt P1, gp_Pnt P2, double& dx, double& dy, double& dz); + static bool LinearEdgeExtremities( const TopoDS_Shape& shape, + gp_Pnt& point1, gp_Pnt& point2 ); + static void GetBipointDxDyDz( const gp_Pnt& point1, const gp_Pnt& point2, + double& dx, double& dy, double& dz ); /* Simulation management */ - static bool CreateArrowForLinearEdge(const TopoDS_Shape& tds, TopoDS_Shape& ArrowCone); + static TopoDS_Shape CreateArrowForLinearEdge( const TopoDS_Shape& tds ); /* Generates default names */ - static bool SelectionByNameInDialogs(QWidget* aWidget, const QString& userObjectName, - const SALOME_ListIO& aList); + static bool SelectionByNameInDialogs( QWidget* widget, + const QString& userObjectName, + const SALOME_ListIO& IObjects ); /* Shows message box with error code */ - static bool DefineDlgPosition(QWidget* aDlg, int& x, int& y); + static void DefineDlgPosition( QWidget* dlg, int& x, int& y ); /* This method generates default names for results of geometrical operations */ - static QString GetDefaultName(const QString& theOperation, const bool extractPrefix = false); + static QString GetDefaultName( const QString& operation, bool extractPrefix = false ); /* Shows message box with error code and comment */ - static void ShowErrorMessage(const char* theErrorCode, const char* theComment = 0); + static void ShowErrorMessage( const QString& errorCode, const QString& comment = QString() ); /* Gets name of object */ - static QString GetName(GEOM::GEOM_Object_ptr); + static QString GetName( GEOM::GEOM_Object_ptr object ); - static bool IsShape(GEOM::GEOM_Object_ptr theObj); + static bool IsShape( GEOM::GEOM_Object_ptr object ); }; #endif // GEOMBASE_H diff --git a/src/GEOMBase/GEOMBase_Helper.cxx b/src/GEOMBase/GEOMBase_Helper.cxx index 28e585e94..ff06a5709 100755 --- a/src/GEOMBase/GEOMBase_Helper.cxx +++ b/src/GEOMBase/GEOMBase_Helper.cxx @@ -1095,23 +1095,17 @@ void GEOMBase_Helper::addSubshapesToFather( QMap SalomeApp_Study* appStudy = dynamic_cast( app->activeStudy() ); _PTR(Study) aDStudy = appStudy->studyDS(); - GEOM::GEOM_IGroupOperations_var anOp = getGeomEngine()->GetIGroupOperations( getStudyId() ); - for( QMap::Iterator it = theMap.begin(); it != theMap.end(); it++ ) { - if ( !anOp->_is_nil() ) { - GEOM::GEOM_Object_var aFatherObj = anOp->GetMainShape( it.value() ); - if ( !aFatherObj->_is_nil() ) { - QString aFatherEntry = getEntry( aFatherObj ); - if ( aFatherEntry != "") { // additional checking that object is valid 0020598 EDF 1191 - GEOM::GEOM_Object_var aFindedObject = findObjectInFather(aFatherObj, it.key().toLatin1().data() ); - //Add Object to study if its not exist - if ( aFindedObject->_is_nil() ) - GeometryGUI::GetGeomGen()->AddInStudy(GeometryGUI::ClientStudyToStudy(aDStudy), - it.value(), it.key().toLatin1().data(), aFatherObj ); - } + GEOM::GEOM_Object_var aFatherObj = it.value()->GetMainShape(); + if ( !aFatherObj->_is_nil() ) { + QString aFatherEntry = getEntry( aFatherObj ); + if ( aFatherEntry != "") { // additional checking that object is valid 0020598 EDF 1191 + GEOM::GEOM_Object_var aFindedObject = findObjectInFather(aFatherObj, it.key().toLatin1().data() ); + //Add Object to study if its not exist + if ( aFindedObject->_is_nil() ) + GeometryGUI::GetGeomGen()->AddInStudy(GeometryGUI::ClientStudyToStudy(aDStudy), + it.value(), it.key().toLatin1().data(), aFatherObj ); } - } else { - //cout << " anOperations is NULL! " << endl; } } } diff --git a/src/GEOMToolsGUI/GEOMToolsGUI.cxx b/src/GEOMToolsGUI/GEOMToolsGUI.cxx index 3d183d976..01208d869 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI.cxx +++ b/src/GEOMToolsGUI/GEOMToolsGUI.cxx @@ -779,10 +779,9 @@ bool GEOMToolsGUI::Export() SALOME_ListIteratorOfListIO It( selectedObjects ); for(;It.More();It.Next()) { Handle(SALOME_InteractiveObject) IObject = It.Value(); - Standard_Boolean found; - GEOM::GEOM_Object_var anObj = GEOMBase::ConvertIOinGEOMObject(IObject, found); + GEOM::GEOM_Object_var anObj = GEOMBase::ConvertIOinGEOMObject( IObject ); - if ( !found || anObj->_is_nil() ) + if ( anObj->_is_nil() ) continue; QString fileType; diff --git a/src/GenerationGUI/GenerationGUI_FillingDlg.cxx b/src/GenerationGUI/GenerationGUI_FillingDlg.cxx index fc343b4b1..930aedc65 100644 --- a/src/GenerationGUI/GenerationGUI_FillingDlg.cxx +++ b/src/GenerationGUI/GenerationGUI_FillingDlg.cxx @@ -219,10 +219,8 @@ void GenerationGUI_FillingDlg::SelectionIntoArgument() } // nbSel == 1 - Standard_Boolean testResult = Standard_False; - GEOM::GEOM_Object_ptr aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult); - - if (!testResult) + GEOM::GEOM_Object_ptr aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() ); + if ( CORBA::is_nil( aSelectedObject ) ) return; if (myEditCurrentArgument == GroupPoints->LineEdit1) { diff --git a/src/GenerationGUI/GenerationGUI_PipeDlg.cxx b/src/GenerationGUI/GenerationGUI_PipeDlg.cxx index a1d4e7fed..ca440e62d 100644 --- a/src/GenerationGUI/GenerationGUI_PipeDlg.cxx +++ b/src/GenerationGUI/GenerationGUI_PipeDlg.cxx @@ -248,11 +248,10 @@ void GenerationGUI_PipeDlg::SelectionIntoArgument() if (aSelList.Extent() < 1) return; - Standard_Boolean testResult = Standard_False; - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult); + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() ); QString aName = GEOMBase::GetName(aSelectedObject); - if (!testResult || aSelectedObject->_is_nil()) + if ( aSelectedObject->_is_nil() ) return; TopoDS_Shape S; diff --git a/src/GenerationGUI/GenerationGUI_PrismDlg.cxx b/src/GenerationGUI/GenerationGUI_PrismDlg.cxx index 4d1b317b0..7c3c4b1b8 100644 --- a/src/GenerationGUI/GenerationGUI_PrismDlg.cxx +++ b/src/GenerationGUI/GenerationGUI_PrismDlg.cxx @@ -349,10 +349,9 @@ void GenerationGUI_PrismDlg::SelectionIntoArgument() return; } - Standard_Boolean testResult = Standard_False; GEOM::GEOM_Object_var aSelectedObject = - GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult); - if (!testResult || CORBA::is_nil(aSelectedObject)) + GEOMBase::ConvertIOinGEOMObject( aSelList.First() ); + if ( CORBA::is_nil(aSelectedObject) ) return; QString aName = GEOMBase::GetName(aSelectedObject); @@ -408,11 +407,10 @@ void GenerationGUI_PrismDlg::SelectionIntoArgument() return; } - Standard_Boolean testResult = Standard_False; GEOM::GEOM_Object_var aSelectedObject = - GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult); + GEOMBase::ConvertIOinGEOMObject( aSelList.First() ); - if (!testResult || CORBA::is_nil(aSelectedObject)) + if ( CORBA::is_nil(aSelectedObject) ) return; QString aName = GEOMBase::GetName(aSelectedObject); diff --git a/src/GenerationGUI/GenerationGUI_RevolDlg.cxx b/src/GenerationGUI/GenerationGUI_RevolDlg.cxx index 466a15c66..53ba3d625 100644 --- a/src/GenerationGUI/GenerationGUI_RevolDlg.cxx +++ b/src/GenerationGUI/GenerationGUI_RevolDlg.cxx @@ -224,11 +224,10 @@ void GenerationGUI_RevolDlg::SelectionIntoArgument() if (aSelList.Extent() < 1) return; - Standard_Boolean testResult = Standard_False; - GEOM::GEOM_Object_ptr aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult); + GEOM::GEOM_Object_ptr aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() ); QString aName = GEOMBase::GetName(aSelectedObject); - if (!testResult || aSelectedObject->_is_nil()) + if ( aSelectedObject->_is_nil() ) return; TopoDS_Shape S;