]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
NPAL 18363
authordmv <dmv@opencascade.com>
Wed, 19 Dec 2007 14:52:13 +0000 (14:52 +0000)
committerdmv <dmv@opencascade.com>
Wed, 19 Dec 2007 14:52:13 +0000 (14:52 +0000)
src/GenerationGUI/GenerationGUI_PipeDlg.cxx
src/GenerationGUI/GenerationGUI_PrismDlg.cxx
src/GenerationGUI/GenerationGUI_RevolDlg.cxx

index f086619532859f40eb74a8ea9848869225873f21..356be1f82eabf76047d112637bff32e384222db5 100644 (file)
@@ -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();
 }
index cc417d0f5ce6eb0caee4f42b72355992bedff2c2..283c327b79dea57cf3e0b1d873ee9084bf9857b4 100644 (file)
@@ -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();
index fa1d703ff4e9eeb8ed0b3bd5ff07bbefce924fae..604423f5613e886739a2d8d6f479d68e9e500f32 100644 (file)
@@ -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();