]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
0020044: EDF 866 GEOM: Extrusion along a path : impossible to select a Wire
authordmv <dmv@opencascade.com>
Tue, 18 Nov 2008 11:51:02 +0000 (11:51 +0000)
committerdmv <dmv@opencascade.com>
Tue, 18 Nov 2008 11:51:02 +0000 (11:51 +0000)
src/GEOMGUI/GEOM_msg_en.ts
src/GenerationGUI/GenerationGUI_PipeDlg.cxx
src/GenerationGUI/GenerationGUI_PipeDlg.h

index 56697113cd5847f024cacc5497d1d20baba4c60b..361dde1f59c172c1c712c7a12beec5ae0fae3331 100644 (file)
@@ -1044,6 +1044,10 @@ Please, select face, shell or solid and try again</translation>
             <source>GEOM_PIPE_TITLE</source>
             <translation>Pipe Construction</translation>
         </message>
+       <message>
+            <source>GEOM_SELECT_UNPUBLISHED_EDGES</source>
+            <translation>Select unpublished edges</translation>
+        </message>
         <message>
             <source>GEOM_PLANE</source>
             <translation>Plane</translation>
index 0bc5e05f1b3311df218b36b5bb0f995d390447ee..2492447bdc72c10a9335b4e689b1f78eacd9fcac 100644 (file)
@@ -39,6 +39,8 @@
 #include <TopExp.hxx>
 #include <TColStd_IndexedMapOfInteger.hxx>
 #include <TopTools_IndexedMapOfShape.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
+#include <TColStd_MapOfInteger.hxx>
 
 #include <GEOMImpl_Types.hxx>
 
@@ -66,7 +68,7 @@ GenerationGUI_PipeDlg::GenerationGUI_PipeDlg (GeometryGUI* theGeometryGUI, QWidg
   mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose);
   mainFrame()->RadioButton3->close();
 
-  GroupPoints = new DlgRef_3Sel(centralWidget());
+  GroupPoints = new DlgRef_3Sel1Check(centralWidget());
 
   GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
   GroupPoints->TextLabel1->setText(tr("GEOM_BASE_OBJECT"));
@@ -75,6 +77,7 @@ GenerationGUI_PipeDlg::GenerationGUI_PipeDlg (GeometryGUI* theGeometryGUI, QWidg
   GroupPoints->PushButton1->setIcon(image1);
   GroupPoints->PushButton2->setIcon(image1);
   GroupPoints->PushButton3->setIcon(image1);
+  GroupPoints->CheckButton1->setText(tr("GEOM_SELECT_UNPUBLISHED_EDGES"));
 
   QVBoxLayout* layout = new QVBoxLayout(centralWidget());
   layout->setMargin(0); layout->setSpacing(6);
@@ -113,6 +116,8 @@ void GenerationGUI_PipeDlg::Init()
   myBase = myPath = myVec = GEOM::GEOM_Object::_nil();
   myOkBase = myOkPath = myOkVec = false;
 
+  GroupPoints->CheckButton1->setEnabled(false);
+
   // signals and slots connections
   connect(buttonOk(),    SIGNAL(clicked()), this, SLOT(ClickOnOk()));
   connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
@@ -127,6 +132,8 @@ void GenerationGUI_PipeDlg::Init()
   connect(GroupPoints->LineEdit2,   SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
   connect(GroupPoints->LineEdit3,   SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
 
+  connect(GroupPoints->CheckButton1,   SIGNAL(toggled(bool)), this, SLOT(SelectionTypeButtonClicked()));
+
   initName(tr("GEOM_PIPE"));
 
   GroupPoints->TextLabel3->hide();
@@ -167,6 +174,23 @@ void GenerationGUI_PipeDlg::ConstructorsClicked( int constructorId )
   displayPreview();
 }
 
+//=================================================================================
+// function : SelectionBittonClicked()
+// purpose  : Selection type Radio button management
+//=================================================================================
+void GenerationGUI_PipeDlg::SelectionTypeButtonClicked()
+{
+  if ( GroupPoints->CheckButton1->isChecked() ) {
+    globalSelection();
+    localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
+  } else {
+    TColStd_MapOfInteger aMap;
+    aMap.Add(GEOM_WIRE);
+    aMap.Add(GEOM_LINE);
+    globalSelection(aMap);
+  }
+}
+
 //=================================================================================
 // function : ClickOnOk()
 // purpose  :
@@ -249,57 +273,66 @@ void GenerationGUI_PipeDlg::SelectionIntoArgument()
     bool myOk = false;
     QString aName = GEOMBase::GetName(aSelectedObject);
 
-    if (aSelectedObject != myBase) {
-      TColStd_IndexedMapOfInteger aMap;
-      aSelMgr->GetIndexes(aSelList.First(), aMap);
-      if (aMap.Extent() == 1) {
-        int anIndex = aMap(1);
-        aName.append(":edge_" + QString::number(anIndex));
-
-        //Find SubShape Object in Father
-        GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName);
-
-        if (aFindedObject == GEOM::GEOM_Object::_nil()) { // Object not found in study
-          GEOM::GEOM_IShapesOperations_var aShapesOp =
-            getGeomEngine()->GetIShapesOperations(getStudyId());
-          aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
-          myOk = true;
-        }
-        else { // get Object from study
-          aSelectedObject = aFindedObject;
-          myOk = true;
-        }
-      }
-      else {
-        myOk = true;
-        if (S.ShapeType() != TopAbs_EDGE) {
-          aSelectedObject = GEOM::GEOM_Object::_nil();
-          aName = "";
-          myOk = false;
-        }
-      }
-      if (myEditCurrentArgument == GroupPoints->LineEdit2) {
-       myPath = aSelectedObject;
-       myOkPath = myOk;
-      }
-      else if (myEditCurrentArgument == GroupPoints->LineEdit3) {
-       myVec = aSelectedObject;
-       myOkVec = myOk;
-      }
-    }
-    myEditCurrentArgument->setText(aName);
-    if (myOkPath) {
-      if (!myOkBase)
-       GroupPoints->PushButton1->click();
-      else if (!myOkVec)
-       GroupPoints->PushButton3->click();
-    }
-    else if (myOkVec) {
-      if (!myOkBase)
-       GroupPoints->PushButton1->click();
-      else if (!myOkPath)
-       GroupPoints->PushButton2->click();
+    if (myEditCurrentArgument == GroupPoints->LineEdit2 && !GroupPoints->CheckButton1->isChecked() ){
+      myPath = aSelectedObject;
+      myOkPath = true;
+      myEditCurrentArgument->setText(aName);
     }
+    else 
+      { 
+       if (aSelectedObject != myBase) {
+         TColStd_IndexedMapOfInteger aMap;
+         aSelMgr->GetIndexes(aSelList.First(), aMap);
+         if (aMap.Extent() == 1) {
+           int anIndex = aMap(1);
+           aName.append(":edge_" + QString::number(anIndex));
+           
+           //Find SubShape Object in Father
+           GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName);
+           
+           if (aFindedObject == GEOM::GEOM_Object::_nil()) { // Object not found in study
+             GEOM::GEOM_IShapesOperations_var aShapesOp =
+               getGeomEngine()->GetIShapesOperations(getStudyId());
+             aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+             myOk = true;
+           }
+           else { // get Object from study
+             aSelectedObject = aFindedObject;
+             myOk = true;
+           }
+         }
+         else {
+           myOk = true;
+           if (S.ShapeType() != TopAbs_EDGE) {
+             aSelectedObject = GEOM::GEOM_Object::_nil();
+             aName = "";
+             myOk = false;
+           }
+         }
+         if (myEditCurrentArgument == GroupPoints->LineEdit2) {
+           myPath = aSelectedObject;
+           myOkPath = myOk;
+         }
+         else if (myEditCurrentArgument == GroupPoints->LineEdit3) {
+           myVec = aSelectedObject;
+           myOkVec = myOk;
+         }
+       }
+       myEditCurrentArgument->setText(aName);
+
+       if (myOkPath) {
+         if (!myOkBase)
+           GroupPoints->PushButton1->click();
+         else if (!myOkVec)
+           GroupPoints->PushButton3->click();
+       }
+       else if (myOkVec) {
+         if (!myOkBase)
+           GroupPoints->PushButton1->click();
+         else if (!myOkPath)
+           GroupPoints->PushButton2->click();
+       }
+      }
   }
 
   // clear selection
@@ -329,15 +362,24 @@ void GenerationGUI_PipeDlg::SetEditCurrentArgument()
   GroupPoints->LineEdit3->setEnabled(false);
   if (send == GroupPoints->PushButton1) {
     myEditCurrentArgument = GroupPoints->LineEdit1;
+    GroupPoints->CheckButton1->setEnabled(false);
   }
   else if (send == GroupPoints->PushButton2) {
     myEditCurrentArgument = GroupPoints->LineEdit2;
 
-    localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
+    if ( GroupPoints->CheckButton1->isChecked() ) {
+      localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
+    } else {
+      TColStd_MapOfInteger aMap;
+      aMap.Add(GEOM_WIRE);
+      aMap.Add(GEOM_LINE);
+      globalSelection(aMap);
+    }
+    GroupPoints->CheckButton1->setEnabled(true);
   }
   else if(send == GroupPoints->PushButton3) {
     myEditCurrentArgument = GroupPoints->LineEdit3;
-
+    GroupPoints->CheckButton1->setEnabled(false);
     localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
   }
   connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
@@ -366,6 +408,11 @@ void GenerationGUI_PipeDlg::LineEditReturnPressed()
     myEditCurrentArgument = send;
     GEOMBase_Skeleton::LineEditReturnPressed();
   }
+
+  if (send == GroupPoints->LineEdit2)
+    GroupPoints->CheckButton1->setEnabled(true);
+  else
+    GroupPoints->CheckButton1->setEnabled(false);
 }
 
 //=================================================================================
@@ -376,8 +423,9 @@ void GenerationGUI_PipeDlg::ActivateThisDialog()
 {
   GEOMBase_Skeleton::ActivateThisDialog();
 
-  // reinit, because some selected objects could be removed
-  Init();
+  connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 
+         SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+  ConstructorsClicked(getConstructorId());
 }
 
 //=================================================================================
index 51ebe83624dbc7c34a5e7f74c33e86118e7216ed..757c1e9567407432395ab4f883e820cd4a88dee7 100644 (file)
@@ -28,7 +28,7 @@
 
 #include <GEOMBase_Skeleton.h>
 
-class DlgRef_3Sel;
+class DlgRef_3Sel1Check;
 
 //=================================================================================
 // class    : GenerationGUI_PipeDlg
@@ -61,7 +61,7 @@ private:
   bool                               myOkPath;
   bool                               myOkVec; /* to check when arguments are defined */
   
-  DlgRef_3Sel*                       GroupPoints;
+  DlgRef_3Sel1Check*                       GroupPoints;
 
 private slots:
   void                               ClickOnOk();
@@ -71,6 +71,7 @@ private slots:
   void                               SelectionIntoArgument();
   void                               SetEditCurrentArgument();
   void                               ConstructorsClicked( int );
+  void                               SelectionTypeButtonClicked();
 };
 
 #endif // GENERATIONGUI_PIPEDLG_H