Code refactoring

This commit is contained in:
inv 2010-12-29 11:12:27 +00:00
parent e9605e4e5b
commit 5a0b94e3b5
29 changed files with 562 additions and 755 deletions

View File

@ -410,10 +410,9 @@ void AdvancedGUI_PipeTShapeDlg::SelectionIntoArgument() {
// nbSel == 1 // nbSel == 1
if (aSelList.Extent() == 1) { if (aSelList.Extent() == 1) {
Standard_Boolean aRes = Standard_False;
Handle(SALOME_InteractiveObject) anIO = aSelList.First(); Handle(SALOME_InteractiveObject) anIO = aSelList.First();
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(anIO, aRes); GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(anIO);
if (!CORBA::is_nil(aSelectedObject) && aRes) { if (!CORBA::is_nil(aSelectedObject)) {
QString aName = GEOMBase::GetName(aSelectedObject); QString aName = GEOMBase::GetName(aSelectedObject);
TopoDS_Shape aShape; TopoDS_Shape aShape;
if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull()) { if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull()) {
@ -471,9 +470,8 @@ void AdvancedGUI_PipeTShapeDlg::SelectionIntoArgument() {
DisplayPreview(); DisplayPreview();
} }
// Standard_Boolean testResult = Standard_False; // GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First());
// GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult); // if (aSelectedObject->_is_nil())
// if (!testResult || aSelectedObject->_is_nil())
// return; // return;
// //
// myEditCurrentArgument->setText(GEOMBase::GetName(aSelectedObject)); // myEditCurrentArgument->setText(GEOMBase::GetName(aSelectedObject));

View File

@ -269,9 +269,8 @@ void BasicGUI_ArcDlg::SelectionIntoArgument()
} }
} }
// nbSel == 1 // nbSel == 1
Standard_Boolean aRes = Standard_False; GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aRes); if ( !CORBA::is_nil( aSelectedObject ) ) {
if ( !CORBA::is_nil( aSelectedObject ) && aRes ) {
QString aName = GEOMBase::GetName(aSelectedObject); QString aName = GEOMBase::GetName(aSelectedObject);
// Get Selected object if selected subshape // Get Selected object if selected subshape

View File

@ -334,9 +334,8 @@ void BasicGUI_CircleDlg::SelectionIntoArgument()
// nbSel == 1 // nbSel == 1
Handle(SALOME_InteractiveObject) anIO = aList.First(); Handle(SALOME_InteractiveObject) anIO = aList.First();
Standard_Boolean aRes = Standard_False; GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIO );
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(anIO, aRes); if ( !CORBA::is_nil( aSelectedObject ) ) {
if ( !CORBA::is_nil( aSelectedObject ) && aRes ) {
QString aName = GEOMBase::GetName( aSelectedObject ); QString aName = GEOMBase::GetName( aSelectedObject );
TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX; TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;

View File

@ -286,8 +286,6 @@ void BasicGUI_CurveDlg::SelectionIntoArgument()
{ {
myEditCurrentArgument->setText( "" ); myEditCurrentArgument->setText( "" );
Standard_Boolean aRes = Standard_False;
SalomeApp_Application* app = myGeomGUI->getApp(); SalomeApp_Application* app = myGeomGUI->getApp();
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>(app->activeStudy()); SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>(app->activeStudy());
_PTR(Study) aDStudy = appStudy->studyDS(); _PTR(Study) aDStudy = appStudy->studyDS();
@ -308,8 +306,8 @@ void BasicGUI_CurveDlg::SelectionIntoArgument()
// that will actually be put into myPoints // that will actually be put into myPoints
for (SALOME_ListIteratorOfListIO anIt (selected); anIt.More(); anIt.Next()) { for (SALOME_ListIteratorOfListIO anIt (selected); anIt.More(); anIt.Next()) {
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(anIt.Value(), aRes); GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIt.Value() );
if (!CORBA::is_nil(aSelectedObject) && aRes) { if (!CORBA::is_nil(aSelectedObject) ) {
if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull()) { if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull()) {
aSelMgr->GetIndexes(anIt.Value(), aMapIndexes); aSelMgr->GetIndexes(anIt.Value(), aMapIndexes);

View File

@ -235,10 +235,9 @@ void BasicGUI_EllipseDlg::SelectionIntoArgument()
return; return;
} }
Standard_Boolean aRes = Standard_False;
Handle(SALOME_InteractiveObject) anIO = aSelList.First(); Handle(SALOME_InteractiveObject) anIO = aSelList.First();
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(anIO, aRes); GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIO );
if (!CORBA::is_nil(aSelectedObject) && aRes) { if (!CORBA::is_nil(aSelectedObject) ) {
QString aName = GEOMBase::GetName(aSelectedObject); QString aName = GEOMBase::GetName(aSelectedObject);
// Get Selected object if selected subshape // Get Selected object if selected subshape

View File

@ -252,9 +252,8 @@ void BasicGUI_LineDlg::SelectionIntoArgument()
return; return;
} }
Standard_Boolean aRes = Standard_False; GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aRes); if ( !CORBA::is_nil( aSelectedObject ) ) {
if ( !CORBA::is_nil( aSelectedObject ) && aRes ) {
QString aName = GEOMBase::GetName( aSelectedObject ); QString aName = GEOMBase::GetName( aSelectedObject );
TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX; TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;
if ( myEditCurrentArgument == GroupFaces->LineEdit1 || if ( myEditCurrentArgument == GroupFaces->LineEdit1 ||

View File

@ -333,11 +333,10 @@ void BasicGUI_MarkerDlg::onSelectionDone0()
aSelMgr->selectedObjects(aSelList); aSelMgr->selectedObjects(aSelList);
if (aSelList.Extent() == 1) { if (aSelList.Extent() == 1) {
Standard_Boolean aRes = Standard_False;
Handle(SALOME_InteractiveObject) anIO = aSelList.First(); 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; TopoDS_Shape aShape;
if ( GEOMBase::GetShape( aSelectedObj, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) { if ( GEOMBase::GetShape( aSelectedObj, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) {
// Existing LCS selected // Existing LCS selected
@ -409,11 +408,10 @@ void BasicGUI_MarkerDlg::onSelectionDone()
aSelMgr->selectedObjects(aSelList); aSelMgr->selectedObjects(aSelList);
if (aSelList.Extent() == 1) { if (aSelList.Extent() == 1) {
Standard_Boolean aRes = Standard_False;
Handle(SALOME_InteractiveObject) anIO = aSelList.First(); 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 ); QString aName = GEOMBase::GetName( aSelectedObj );
if ( getConstructorId() == 1 ) { // by shape position if ( getConstructorId() == 1 ) { // by shape position

View File

@ -442,9 +442,8 @@ void BasicGUI_PlaneDlg::SelectionIntoArgument()
} }
// nbSel == 1 // nbSel == 1
Standard_Boolean aRes = Standard_False; GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aRes); if ( !CORBA::is_nil( aSelectedObject ) ) {
if ( !CORBA::is_nil( aSelectedObject ) && aRes ) {
QString aName = GEOMBase::GetName( aSelectedObject ); QString aName = GEOMBase::GetName( aSelectedObject );
TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX; TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;
if ( myEditCurrentArgument == GroupPntDir->LineEdit2 || myEditCurrentArgument == Group2Vec->LineEdit1 || myEditCurrentArgument == Group2Vec->LineEdit2) if ( myEditCurrentArgument == GroupPntDir->LineEdit2 || myEditCurrentArgument == Group2Vec->LineEdit1 || myEditCurrentArgument == Group2Vec->LineEdit2)

View File

@ -489,10 +489,9 @@ void BasicGUI_PointDlg::SelectionIntoArgument()
aSelMgr->selectedObjects(aSelList); aSelMgr->selectedObjects(aSelList);
if (aSelList.Extent() == 1) { if (aSelList.Extent() == 1) {
Standard_Boolean aRes = Standard_False;
Handle(SALOME_InteractiveObject) anIO = aSelList.First(); Handle(SALOME_InteractiveObject) anIO = aSelList.First();
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIO, aRes ); GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIO );
if ( !CORBA::is_nil( aSelectedObject ) && aRes ) { if ( !CORBA::is_nil( aSelectedObject ) ) {
QString aName = GEOMBase::GetName(aSelectedObject); QString aName = GEOMBase::GetName(aSelectedObject);
TopoDS_Shape aShape; TopoDS_Shape aShape;
if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) { if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) {

View File

@ -286,9 +286,8 @@ void BasicGUI_VectorDlg::SelectionIntoArgument()
} }
// nbSel == 1 // nbSel == 1
Standard_Boolean aRes = Standard_False; GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aRes); if (!CORBA::is_nil(aSelectedObject) ) {
if (!CORBA::is_nil(aSelectedObject) && aRes) {
QString aName = GEOMBase::GetName(aSelectedObject); QString aName = GEOMBase::GetName(aSelectedObject);
TopoDS_Shape aShape; TopoDS_Shape aShape;

View File

@ -247,10 +247,9 @@ void BlocksGUI_BlockDlg::SelectionIntoArgument()
} }
// nbSel == 1 // nbSel == 1
Standard_Boolean testResult = Standard_False; GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
if (!testResult || CORBA::is_nil(aSelectedObject)) if ( CORBA::is_nil(aSelectedObject) )
return; return;
QString aName = GEOMBase::GetName(aSelectedObject); QString aName = GEOMBase::GetName(aSelectedObject);

View File

@ -213,10 +213,9 @@ void BlocksGUI_ExplodeDlg::SelectionIntoArgument()
aSelMgr->selectedObjects(aSelList); aSelMgr->selectedObjects(aSelList);
if (aSelList.Extent() == 1) { if (aSelList.Extent() == 1) {
Standard_Boolean aResult = Standard_False; GEOM::GEOM_Object_var anObj = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
GEOM::GEOM_Object_var anObj = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aResult);
if (aResult && !anObj->_is_nil() && GEOMBase::IsShape(anObj)) { if ( GEOMBase::IsShape(anObj) ) {
myObject = anObj; myObject = anObj;
myGrp1->LineEdit1->setText(GEOMBase::GetName(anObj)); myGrp1->LineEdit1->setText(GEOMBase::GetName(anObj));
} }

View File

@ -156,9 +156,8 @@ void BlocksGUI_PropagateDlg::SelectionIntoArgument()
if (aSelList.Extent() == 1) { if (aSelList.Extent() == 1) {
Handle(SALOME_InteractiveObject) anIO = aSelList.First(); Handle(SALOME_InteractiveObject) anIO = aSelList.First();
Standard_Boolean aRes; myObject = GEOMBase::ConvertIOinGEOMObject( anIO );
myObject = GEOMBase::ConvertIOinGEOMObject( anIO, aRes ); if ( !CORBA::is_nil( myObject ) )
if ( aRes )
myGrp->LineEdit1->setText( GEOMBase::GetName( myObject ) ); myGrp->LineEdit1->setText( GEOMBase::GetName( myObject ) );
} }
} }

View File

@ -239,9 +239,8 @@ void BlocksGUI_QuadFaceDlg::SelectionIntoArgument()
GEOM::GEOM_Object_var anObj = GEOM::GEOM_Object::_nil(); GEOM::GEOM_Object_var anObj = GEOM::GEOM_Object::_nil();
if (aSelList.Extent() == 1) { if (aSelList.Extent() == 1) {
Standard_Boolean aResult = Standard_False; anObj = GEOMBase::ConvertIOinGEOMObject(aSelList. First() );
anObj = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aResult); if ( !anObj->_is_nil() ) {
if (aResult && !anObj->_is_nil()) {
aName = GEOMBase::GetName(anObj); aName = GEOMBase::GetName(anObj);
// Get Selected object if selected subshape // Get Selected object if selected subshape

View File

@ -240,10 +240,9 @@ void BlocksGUI_TrsfDlg::SelectionIntoArgument()
{ {
// If selection of main object is activated // If selection of main object is activated
if (aSelList.Extent() == 1) { if (aSelList.Extent() == 1) {
Standard_Boolean aResult = Standard_False; anObj = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
anObj = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aResult);
if (aResult && !anObj->_is_nil() && GEOMBase::IsShape(anObj)) { if ( GEOMBase::IsShape(anObj) ) {
aName = GEOMBase::GetName(anObj); aName = GEOMBase::GetName(anObj);
} }
} }
@ -257,9 +256,8 @@ void BlocksGUI_TrsfDlg::SelectionIntoArgument()
// If face selection is activated // If face selection is activated
int anIndex = -1; int anIndex = -1;
if (aSelList.Extent() == 1) { if (aSelList.Extent() == 1) {
Standard_Boolean aResult = Standard_False; anObj = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
anObj = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aResult); if ( GEOMBase::IsShape(anObj) ) {
if (aResult && !anObj->_is_nil() && GEOMBase::IsShape(anObj)) {
aName = GEOMBase::GetName(anObj); aName = GEOMBase::GetName(anObj);
TColStd_IndexedMapOfInteger anIndexes; TColStd_IndexedMapOfInteger anIndexes;
aSelMgr->GetIndexes(aSelList.First(), anIndexes); aSelMgr->GetIndexes(aSelList.First(), anIndexes);

View File

@ -209,9 +209,8 @@ void BooleanGUI_Dialog::SelectionIntoArgument()
} }
// nbSel == 1 // nbSel == 1
Standard_Boolean aRes = Standard_False; GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aRes); if ( GEOMBase::IsShape(aSelectedObject) )
if (!CORBA::is_nil(aSelectedObject) && aRes && GEOMBase::IsShape(aSelectedObject))
{ {
myEditCurrentArgument->setText(GEOMBase::GetName(aSelectedObject)); myEditCurrentArgument->setText(GEOMBase::GetName(aSelectedObject));
@ -314,9 +313,8 @@ GEOM::GEOM_IOperations_ptr BooleanGUI_Dialog::createOperation()
bool BooleanGUI_Dialog::isValid (QString&) bool BooleanGUI_Dialog::isValid (QString&)
{ {
//Handle(SALOME_InteractiveObject) IO = firstIObject(); //Handle(SALOME_InteractiveObject) IO = firstIObject();
//Standard_Boolean testResult; //GEOM::GEOM_Object_var anObject = GEOMBase::ConvertIOinGEOMObject( IO );
//GEOM::GEOM_Object_var anObject = GEOMBase::ConvertIOinGEOMObject(IO, testResult); //if ( anObject->_is_nil() )
//if (!testResult || anObject->_is_nil())
// return false; // return false;
return !CORBA::is_nil(myObject1) && !CORBA::is_nil(myObject2); return !CORBA::is_nil(myObject1) && !CORBA::is_nil(myObject2);

View File

@ -246,10 +246,9 @@ void BuildGUI_EdgeDlg::SelectionIntoArgument()
} }
// nbSel == 1 // nbSel == 1
Standard_Boolean testResult = Standard_False; GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
if ( testResult && !aSelectedObject->_is_nil() ) { if ( !aSelectedObject->_is_nil() ) {
QString aName = GEOMBase::GetName( aSelectedObject ); QString aName = GEOMBase::GetName( aSelectedObject );
TopAbs_ShapeEnum aNeedType = myEditCurrentArgument == GroupWire->LineEdit1 ? TopAbs_WIRE : TopAbs_VERTEX; TopAbs_ShapeEnum aNeedType = myEditCurrentArgument == GroupWire->LineEdit1 ? TopAbs_WIRE : TopAbs_VERTEX;

View File

@ -216,11 +216,10 @@ void BuildGUI_WireDlg::SelectionIntoArgument()
std::list<GEOM::GEOM_Object_var> aList; // subshapes list std::list<GEOM::GEOM_Object_var> aList; // subshapes list
TopoDS_Shape aShape; TopoDS_Shape aShape;
Standard_Boolean aRes = Standard_False;
for (SALOME_ListIteratorOfListIO anIt (aSelList); anIt.More(); anIt.Next()) { for (SALOME_ListIteratorOfListIO anIt (aSelList); anIt.More(); anIt.Next()) {
TColStd_IndexedMapOfInteger aMap; TColStd_IndexedMapOfInteger aMap;
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIt.Value(), aRes ); GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIt.Value() );
if ( !CORBA::is_nil(aSelectedObject) && aRes && GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) { if ( !CORBA::is_nil(aSelectedObject) && GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) {
aSelMgr->GetIndexes( anIt.Value(), aMap ); aSelMgr->GetIndexes( anIt.Value(), aMap );
if ( aMap.Extent() > 0 ) { // local selection if ( aMap.Extent() > 0 ) { // local selection

View File

@ -299,9 +299,8 @@ void EntityGUI_3DSketcherDlg::SelectionIntoArgument()
int nbSel = aSelList.Extent(); int nbSel = aSelList.Extent();
if ( nbSel == 1 ) { if ( nbSel == 1 ) {
Standard_Boolean aRes = Standard_False; GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aRes); if ( !CORBA::is_nil(aSelectedObject) ) {
if (!CORBA::is_nil(aSelectedObject) && aRes) {
TopoDS_Shape aShape; TopoDS_Shape aShape;
if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE)) { // Explore the shape if its a local selection if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE)) { // Explore the shape if its a local selection
TColStd_IndexedMapOfInteger aMap; TColStd_IndexedMapOfInteger aMap;

View File

@ -1144,9 +1144,8 @@ void EntityGUI_SketcherDlg::SelectionIntoArgument()
int nbSel = aSelList.Extent(); int nbSel = aSelList.Extent();
if (nbSel == 1 && myEditCurrentArgument == Group1Sel->LineEdit1) { if (nbSel == 1 && myEditCurrentArgument == Group1Sel->LineEdit1) {
Standard_Boolean aRes = Standard_False; GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aRes); if ( !CORBA::is_nil(aSelectedObject) ) {
if (!CORBA::is_nil(aSelectedObject) && aRes) {
TopoDS_Shape aShape; TopoDS_Shape aShape;
if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_VERTEX)) { if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_VERTEX)) {
gp_Trsf aTrans; gp_Trsf aTrans;
@ -1188,9 +1187,8 @@ void EntityGUI_SketcherDlg::SelectionIntoArgument()
} }
if (nbSel == 1 && myEditCurrentArgument == Group1Sel1Spin->LineEdit1) { if (nbSel == 1 && myEditCurrentArgument == Group1Sel1Spin->LineEdit1) {
Standard_Boolean aRes = Standard_False; GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aRes); if ( !CORBA::is_nil(aSelectedObject) ) {
if (!CORBA::is_nil(aSelectedObject) && aRes) {
TopoDS_Shape aShape; TopoDS_Shape aShape;
if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_VERTEX)) { if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_VERTEX)) {
gp_Trsf aTrans; gp_Trsf aTrans;
@ -1232,9 +1230,8 @@ void EntityGUI_SketcherDlg::SelectionIntoArgument()
} }
if (nbSel == 1 && myEditCurrentArgument == Group2Sel->LineEdit1) { if (nbSel == 1 && myEditCurrentArgument == Group2Sel->LineEdit1) {
Standard_Boolean aRes = Standard_False; GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aRes); if ( !CORBA::is_nil(aSelectedObject) ) {
if (!CORBA::is_nil(aSelectedObject) && aRes) {
TopoDS_Shape aShape; TopoDS_Shape aShape;
if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_VERTEX)) { if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_VERTEX)) {
gp_Trsf aTrans; gp_Trsf aTrans;
@ -1280,9 +1277,8 @@ void EntityGUI_SketcherDlg::SelectionIntoArgument()
myX=tmpX; // If yes keep the old values of X and Y myX=tmpX; // If yes keep the old values of X and Y
myY=tmpY; myY=tmpY;
} }
Standard_Boolean aRes = Standard_False; GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aRes); if ( !CORBA::is_nil(aSelectedObject) ) {
if (!CORBA::is_nil(aSelectedObject) && aRes) {
TopoDS_Shape aShape; TopoDS_Shape aShape;
if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_VERTEX)) { if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_VERTEX)) {
gp_Trsf aTrans; gp_Trsf aTrans;

View File

@ -213,7 +213,6 @@ void EntityGUI_SubShapeDlg::SelectionIntoArgument()
if (nbSel != 1) if (nbSel != 1)
return; return;
TopoDS_Shape S;
Handle(SALOME_InteractiveObject) IO = aSelList.First(); Handle(SALOME_InteractiveObject) IO = aSelList.First();
if ( !IO->hasEntry() ) { if ( !IO->hasEntry() ) {
SUIT_Session::session()->activeApplication()->putInfo( tr( "GEOM_PRP_SHAPE_IN_STUDY" ) ); SUIT_Session::session()->activeApplication()->putInfo( tr( "GEOM_PRP_SHAPE_IN_STUDY" ) );
@ -221,17 +220,15 @@ void EntityGUI_SubShapeDlg::SelectionIntoArgument()
return; return;
} }
if (!GEOMBase::GetTopoFromSelection(aSelList, S) || TopoDS_Shape S = GEOMBase::GetTopoFromSelection( aSelList );
S.IsNull() || if ( S.IsNull() || S.ShapeType() == TopAbs_VERTEX ) {
S.ShapeType() == TopAbs_VERTEX) {
myObject = GEOM::GEOM_Object::_nil(); myObject = GEOM::GEOM_Object::_nil();
updateButtonState(); updateButtonState();
return; return;
} }
Standard_Boolean testResult; myObject = GEOMBase::ConvertIOinGEOMObject( IO );
myObject = GEOMBase::ConvertIOinGEOMObject(IO, testResult); if ( myObject->_is_nil() ) {
if (!testResult || myObject->_is_nil()) {
updateButtonState(); updateButtonState();
return; return;
} }
@ -537,9 +534,8 @@ bool EntityGUI_SubShapeDlg::isValid (QString& msg)
aSelMgr->selectedObjects(aSelList); aSelMgr->selectedObjects(aSelList);
if (aSelList.Extent() == 1) { if (aSelList.Extent() == 1) {
Standard_Boolean testResult; GEOM::GEOM_Object_var anObj = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
GEOM::GEOM_Object_var anObj = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult); if ( !anObj->_is_nil() ) {
if (testResult && !anObj->_is_nil()) {
TColStd_IndexedMapOfInteger aMapIndex; TColStd_IndexedMapOfInteger aMapIndex;
aSelMgr->GetIndexes(aSelList.First(), aMapIndex); aSelMgr->GetIndexes(aSelList.First(), aMapIndex);
isOk = aMapIndex.Extent() > 0; isOk = aMapIndex.Extent() > 0;
@ -572,11 +568,10 @@ bool EntityGUI_SubShapeDlg::execute (ObjectList& objects)
aSelMgr->selectedObjects(aSelList); aSelMgr->selectedObjects(aSelList);
if (aSelList.Extent() == 1) { if (aSelList.Extent() == 1) {
Standard_Boolean aResult = Standard_False;
GEOM::GEOM_Object_var anObj = 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; TColStd_IndexedMapOfInteger aMapIndex;
aSelMgr->GetIndexes(aSelList.First(), aMapIndex); aSelMgr->GetIndexes(aSelList.First(), aMapIndex);

File diff suppressed because it is too large Load Diff

View File

@ -54,70 +54,75 @@ class GEOMBASE_EXPORT GEOMBase
{ {
public : public :
/* Selection and objects management */ /* Selection and objects management */
static int GetIndex(const TopoDS_Shape& subshape, const TopoDS_Shape& shape, int ShapeType); static int GetIndex( const TopoDS_Shape& subshape, const TopoDS_Shape& shape );
static TopoDS_Shape GetShapeFromIOR(QString IOR); static TopoDS_Shape GetShapeFromIOR( const QString& IOR );
static bool GetShape(const GEOM::GEOM_Object_ptr&, TopoDS_Shape&, static bool GetShape( GEOM::GEOM_Object_ptr object,
const TopAbs_ShapeEnum = TopAbs_SHAPE); TopoDS_Shape& shape,
static bool GetTopoFromSelection(const SALOME_ListIO& aList, TopoDS_Shape& tds); const TopAbs_ShapeEnum type = TopAbs_SHAPE );
static int GetNameOfSelectedIObjects(const SALOME_ListIO& aList, QString& aName, static TopoDS_Shape GetTopoFromSelection( const SALOME_ListIO& IObjects );
const bool theShapesOnly = false); static int GetNameOfSelectedIObjects( const SALOME_ListIO& IObjects,
static bool GetShapeTypeString(const TopoDS_Shape& aShape, Standard_CString& aTypeString); QString& name,
const bool shapesOnly = false );
static QString GetShapeTypeString( const TopoDS_Shape& shape );
/* Convertions */ /* Convertions */
static GEOM::GEOM_Object_ptr ConvertIOinGEOMShape(const Handle(SALOME_InteractiveObject)& IO, static Handle(GEOM_AISShape)
Standard_Boolean& testResult); ConvertIOinGEOMAISShape( const Handle(SALOME_InteractiveObject)& IO,
static Handle(GEOM_AISShape) ConvertIOinGEOMAISShape(const Handle(SALOME_InteractiveObject)& IO,
Standard_Boolean& testResult,
bool onlyInActiveView = false ); bool onlyInActiveView = false );
static Handle(AIS_InteractiveObject) GetAIS(const Handle(SALOME_InteractiveObject)& theIO, static Handle(AIS_InteractiveObject)
const bool isOnlyInActiveView = false); GetAIS( const Handle(SALOME_InteractiveObject)& IO,
static void ConvertListOfIOInListOfIOR(const SALOME_ListIO& aList, bool onlyInActiveView = false,
GEOM::string_array& listIOR); bool onlyGeom = false );
static QStringList ConvertListOfIOInListOfIOR( const SALOME_ListIO& IObjects );
static Handle(GEOM_AISShape) ConvertIORinGEOMAISShape(const char * IOR, static Handle(GEOM_AISShape)
Standard_Boolean& testResult, ConvertIORinGEOMAISShape( const QString& IOR,
bool onlyInActiveView = false ); bool onlyInActiveView = false );
static GEOM_Actor* ConvertIORinGEOMActor(const char * IOR, Standard_Boolean& testResult, static GEOM_Actor* ConvertIORinGEOMActor( const QString& IOR,
bool onlyInActiveView = false ); bool onlyInActiveView = false );
static GEOM::GEOM_Object_ptr ConvertIOinGEOMObject(const Handle(SALOME_InteractiveObject)& IO, static GEOM::GEOM_Object_ptr
Standard_Boolean& testResult); ConvertIOinGEOMObject( const Handle(SALOME_InteractiveObject)& IO );
static void ConvertListOfIOInListOfGO(const SALOME_ListIO& aList, static void ConvertListOfIOInListOfGO( const SALOME_ListIO& IObjects,
GEOM::ListOfGO& listGO, GEOM::ListOfGO& geomObjects,
const bool theShapesOnly = false); 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 */ /* 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 */ /* Used just by Plane and Prism */
static bool LinearEdgeExtremities(const TopoDS_Shape& S, gp_Pnt& P1, gp_Pnt& P2); static bool LinearEdgeExtremities( const TopoDS_Shape& shape,
static void GetBipointDxDyDz(gp_Pnt P1, gp_Pnt P2, double& dx, double& dy, double& dz); 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 */ /* Simulation management */
static bool CreateArrowForLinearEdge(const TopoDS_Shape& tds, TopoDS_Shape& ArrowCone); static TopoDS_Shape CreateArrowForLinearEdge( const TopoDS_Shape& tds );
/* Generates default names */ /* Generates default names */
static bool SelectionByNameInDialogs(QWidget* aWidget, const QString& userObjectName, static bool SelectionByNameInDialogs( QWidget* widget,
const SALOME_ListIO& aList); const QString& userObjectName,
const SALOME_ListIO& IObjects );
/* Shows message box with error code */ /* 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 */ /* 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 */ /* 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 */ /* 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 #endif // GEOMBASE_H

View File

@ -1095,11 +1095,8 @@ void GEOMBase_Helper::addSubshapesToFather( QMap<QString, GEOM::GEOM_Object_var>
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() ); SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
_PTR(Study) aDStudy = appStudy->studyDS(); _PTR(Study) aDStudy = appStudy->studyDS();
GEOM::GEOM_IGroupOperations_var anOp = getGeomEngine()->GetIGroupOperations( getStudyId() );
for( QMap<QString, GEOM::GEOM_Object_var>::Iterator it = theMap.begin(); it != theMap.end(); it++ ) { for( QMap<QString, GEOM::GEOM_Object_var>::Iterator it = theMap.begin(); it != theMap.end(); it++ ) {
if ( !anOp->_is_nil() ) { GEOM::GEOM_Object_var aFatherObj = it.value()->GetMainShape();
GEOM::GEOM_Object_var aFatherObj = anOp->GetMainShape( it.value() );
if ( !aFatherObj->_is_nil() ) { if ( !aFatherObj->_is_nil() ) {
QString aFatherEntry = getEntry( aFatherObj ); QString aFatherEntry = getEntry( aFatherObj );
if ( aFatherEntry != "") { // additional checking that object is valid 0020598 EDF 1191 if ( aFatherEntry != "") { // additional checking that object is valid 0020598 EDF 1191
@ -1110,8 +1107,5 @@ void GEOMBase_Helper::addSubshapesToFather( QMap<QString, GEOM::GEOM_Object_var>
it.value(), it.key().toLatin1().data(), aFatherObj ); it.value(), it.key().toLatin1().data(), aFatherObj );
} }
} }
} else {
//cout << " anOperations is NULL! " << endl;
}
} }
} }

View File

@ -779,10 +779,9 @@ bool GEOMToolsGUI::Export()
SALOME_ListIteratorOfListIO It( selectedObjects ); SALOME_ListIteratorOfListIO It( selectedObjects );
for(;It.More();It.Next()) { for(;It.More();It.Next()) {
Handle(SALOME_InteractiveObject) IObject = It.Value(); Handle(SALOME_InteractiveObject) IObject = It.Value();
Standard_Boolean found; GEOM::GEOM_Object_var anObj = GEOMBase::ConvertIOinGEOMObject( IObject );
GEOM::GEOM_Object_var anObj = GEOMBase::ConvertIOinGEOMObject(IObject, found);
if ( !found || anObj->_is_nil() ) if ( anObj->_is_nil() )
continue; continue;
QString fileType; QString fileType;

View File

@ -219,10 +219,8 @@ void GenerationGUI_FillingDlg::SelectionIntoArgument()
} }
// nbSel == 1 // nbSel == 1
Standard_Boolean testResult = Standard_False; GEOM::GEOM_Object_ptr aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
GEOM::GEOM_Object_ptr aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult); if ( CORBA::is_nil( aSelectedObject ) )
if (!testResult)
return; return;
if (myEditCurrentArgument == GroupPoints->LineEdit1) { if (myEditCurrentArgument == GroupPoints->LineEdit1) {

View File

@ -248,11 +248,10 @@ void GenerationGUI_PipeDlg::SelectionIntoArgument()
if (aSelList.Extent() < 1) if (aSelList.Extent() < 1)
return; return;
Standard_Boolean testResult = Standard_False; GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
QString aName = GEOMBase::GetName(aSelectedObject); QString aName = GEOMBase::GetName(aSelectedObject);
if (!testResult || aSelectedObject->_is_nil()) if ( aSelectedObject->_is_nil() )
return; return;
TopoDS_Shape S; TopoDS_Shape S;

View File

@ -349,10 +349,9 @@ void GenerationGUI_PrismDlg::SelectionIntoArgument()
return; return;
} }
Standard_Boolean testResult = Standard_False;
GEOM::GEOM_Object_var aSelectedObject = 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; return;
QString aName = GEOMBase::GetName(aSelectedObject); QString aName = GEOMBase::GetName(aSelectedObject);
@ -408,11 +407,10 @@ void GenerationGUI_PrismDlg::SelectionIntoArgument()
return; return;
} }
Standard_Boolean testResult = Standard_False;
GEOM::GEOM_Object_var aSelectedObject = 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; return;
QString aName = GEOMBase::GetName(aSelectedObject); QString aName = GEOMBase::GetName(aSelectedObject);

View File

@ -224,11 +224,10 @@ void GenerationGUI_RevolDlg::SelectionIntoArgument()
if (aSelList.Extent() < 1) if (aSelList.Extent() < 1)
return; return;
Standard_Boolean testResult = Standard_False; GEOM::GEOM_Object_ptr aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
GEOM::GEOM_Object_ptr aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
QString aName = GEOMBase::GetName(aSelectedObject); QString aName = GEOMBase::GetName(aSelectedObject);
if (!testResult || aSelectedObject->_is_nil()) if ( aSelectedObject->_is_nil() )
return; return;
TopoDS_Shape S; TopoDS_Shape S;