From b51d7706d2326c30ec09004475d6ef7dff43da04 Mon Sep 17 00:00:00 2001 From: dmv Date: Wed, 19 Dec 2007 14:52:13 +0000 Subject: [PATCH] NPAL 18363 --- src/GenerationGUI/GenerationGUI_PipeDlg.cxx | 22 +++++++---- src/GenerationGUI/GenerationGUI_PrismDlg.cxx | 39 ++++++++++++++------ src/GenerationGUI/GenerationGUI_RevolDlg.cxx | 14 ++++--- 3 files changed, 51 insertions(+), 24 deletions(-) diff --git a/src/GenerationGUI/GenerationGUI_PipeDlg.cxx b/src/GenerationGUI/GenerationGUI_PipeDlg.cxx index f08661953..356be1f82 100644 --- a/src/GenerationGUI/GenerationGUI_PipeDlg.cxx +++ b/src/GenerationGUI/GenerationGUI_PipeDlg.cxx @@ -207,12 +207,14 @@ void GenerationGUI_PipeDlg::SelectionIntoArgument() if( !GEOMBase::GetShape(aSelectedObject, S) ) return; + + QString aName = GEOMBase::GetName( aSelectedObject ); if ( testResult && !aSelectedObject->_is_nil() && aSelectedObject != myBase) { LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); TColStd_IndexedMapOfInteger aMap; - QString aName = GEOMBase::GetName( aSelectedObject ); + aSelMgr->GetIndexes( firstIObject(), aMap ); if ( aMap.Extent() == 1 ) { @@ -225,11 +227,16 @@ void GenerationGUI_PipeDlg::SelectionIntoArgument() aSelMgr->clearSelected(); } else { - myPath = aSelectedObject; - myOkPath = true; + myOkPath = true; + if (S.ShapeType() != TopAbs_EDGE) { + aSelectedObject = GEOM::GEOM_Object::_nil(); + aName = ""; + myOkPath = false; } - myEditCurrentArgument->setText( aName ); + myPath = aSelectedObject; + } } + myEditCurrentArgument->setText( aName ); } displayPreview(); @@ -243,17 +250,18 @@ void GenerationGUI_PipeDlg::SelectionIntoArgument() void GenerationGUI_PipeDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); + globalSelection(); if(send == GroupPoints->PushButton1) { GroupPoints->LineEdit1->setFocus(); - myEditCurrentArgument = GroupPoints->LineEdit1; globalSelection( GEOM_ALLSHAPES ); + myEditCurrentArgument = GroupPoints->LineEdit1; } else if(send == GroupPoints->PushButton2) { GroupPoints->LineEdit2->setFocus(); myEditCurrentArgument = GroupPoints->LineEdit2; - GEOM::GEOM_Object_var anObj; - localSelection( anObj, TopAbs_EDGE ); + globalSelection(); + localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE); } SelectionIntoArgument(); } diff --git a/src/GenerationGUI/GenerationGUI_PrismDlg.cxx b/src/GenerationGUI/GenerationGUI_PrismDlg.cxx index cc417d0f5..283c327b7 100644 --- a/src/GenerationGUI/GenerationGUI_PrismDlg.cxx +++ b/src/GenerationGUI/GenerationGUI_PrismDlg.cxx @@ -289,6 +289,7 @@ void GenerationGUI_PrismDlg::SelectionIntoArgument() if (!testResult) return; + bool myOk = true; TopoDS_Shape aShape; QString aName = GEOMBase::GetName( aSelectedObject ); if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) @@ -305,15 +306,22 @@ void GenerationGUI_PrismDlg::SelectionIntoArgument() aName.append( ":edge_" + QString::number( anIndex ) ); aSelMgr->clearSelected(); } + else { + if (aShape.ShapeType() != TopAbs_EDGE && myEditCurrentArgument == GroupPoints->LineEdit2) { + aSelectedObject = GEOM::GEOM_Object::_nil(); + aName = ""; + myOk = false; + } + } } - + if (myEditCurrentArgument == GroupPoints->LineEdit1) { myBase = aSelectedObject; myOkBase = true; } - else if (myEditCurrentArgument == GroupPoints->LineEdit2) { + else if (myEditCurrentArgument == GroupPoints->LineEdit2 && myOk) { + myOkVec = true; myVec = aSelectedObject; - myOkVec = true; } myEditCurrentArgument->setText( aName ); } @@ -343,9 +351,10 @@ void GenerationGUI_PrismDlg::SelectionIntoArgument() QString aName = GEOMBase::GetName( aSelectedObject ); TopoDS_Shape aShape; - + bool myOk = true; if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) { + LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); TColStd_IndexedMapOfInteger aMap; aSelMgr->GetIndexes( firstIObject(), aMap ); @@ -358,21 +367,29 @@ void GenerationGUI_PrismDlg::SelectionIntoArgument() aName.append( ":vertex_" + QString::number( anIndex ) ); aSelMgr->clearSelected(); } + else { + if ( (aShape.ShapeType() != TopAbs_EDGE && myEditCurrentArgument == GroupPoints2->LineEdit2 ) || + (aShape.ShapeType() != TopAbs_EDGE && myEditCurrentArgument == GroupPoints2->LineEdit3 )) { + aSelectedObject = GEOM::GEOM_Object::_nil(); + aName = ""; + myOk = false; + } + } } - + myEditCurrentArgument->setText( aName ); if (myEditCurrentArgument == GroupPoints2->LineEdit1) { myBase = aSelectedObject; myOkBase = true; } - else if (myEditCurrentArgument == GroupPoints2->LineEdit2) { - myPoint1 = aSelectedObject; + else if (myEditCurrentArgument == GroupPoints2->LineEdit2 && myOk) { myOkPnt1 = true; + myPoint1 = aSelectedObject; } - else if (myEditCurrentArgument == GroupPoints2->LineEdit3) { - myPoint2 = aSelectedObject; + else if (myEditCurrentArgument == GroupPoints2->LineEdit3 && myOk) { myOkPnt2 = true; + myPoint2 = aSelectedObject; } } @@ -407,12 +424,11 @@ void GenerationGUI_PrismDlg::LineEditReturnPressed() void GenerationGUI_PrismDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); - globalSelection( GEOM_POINT ); // to break previous local selection + globalSelection( GEOM_ALLSHAPES ); if (send == GroupPoints->PushButton1) { GroupPoints->LineEdit1->setFocus(); myEditCurrentArgument = GroupPoints->LineEdit1; - globalSelection( GEOM_ALLSHAPES ); } else if (send == GroupPoints->PushButton2) { GroupPoints->LineEdit2->setFocus(); @@ -422,7 +438,6 @@ void GenerationGUI_PrismDlg::SetEditCurrentArgument() else if (send == GroupPoints2->PushButton1) { GroupPoints2->LineEdit1->setFocus(); myEditCurrentArgument = GroupPoints2->LineEdit1; - globalSelection( GEOM_ALLSHAPES ); } else if (send == GroupPoints2->PushButton2) { GroupPoints2->LineEdit2->setFocus(); diff --git a/src/GenerationGUI/GenerationGUI_RevolDlg.cxx b/src/GenerationGUI/GenerationGUI_RevolDlg.cxx index fa1d703ff..604423f56 100644 --- a/src/GenerationGUI/GenerationGUI_RevolDlg.cxx +++ b/src/GenerationGUI/GenerationGUI_RevolDlg.cxx @@ -253,12 +253,17 @@ void GenerationGUI_RevolDlg::SelectionIntoArgument() int anIndex = aMap( 1 ); aName.append( ":edge_" + QString::number( anIndex ) ); myAxis = aShapesOp->GetSubShape(aSelectedObject, anIndex); - aSelMgr->clearSelected(); + myOkAxis = true; + } + else { + myOkAxis = true; + if (aShape.ShapeType() != TopAbs_EDGE) { + aSelectedObject = GEOM::GEOM_Object::_nil(); + aName = ""; + myOkAxis = false; } - else myAxis = aSelectedObject; - - myOkAxis = true; + } } } } @@ -284,7 +289,6 @@ void GenerationGUI_RevolDlg::SetEditCurrentArgument() else if(send == GroupPoints->PushButton2) { GroupPoints->LineEdit2->setFocus(); myEditCurrentArgument = GroupPoints->LineEdit2; - //globalSelection( GEOM_LINE ); localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE); } SelectionIntoArgument(); -- 2.39.2