Salome HOME
Issue 0019928: EDF 771 SMESH : Extrusion (Revolution) with normal to a face
authordmv <dmv@opencascade.com>
Fri, 26 Jun 2009 12:10:16 +0000 (12:10 +0000)
committerdmv <dmv@opencascade.com>
Fri, 26 Jun 2009 12:10:16 +0000 (12:10 +0000)
Additional modifications

src/SMESHGUI/SMESHGUI_RevolutionDlg.cxx
src/SMESHGUI/SMESHGUI_RevolutionDlg.h

index dd3f2af306b89cc4c71d3ff8dda16284079ef516..e9e7fef05a8442748dc152179f3791b08db409a3 100644 (file)
@@ -93,7 +93,8 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule )
     mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
     myVectorDefinition(NONE_SELECT),
     myFilterDlg( 0 ),
-    mySelectedObject(SMESH::SMESH_IDSource::_nil())
+    mySelectedObject(SMESH::SMESH_IDSource::_nil()),
+    myActor(0)
 {
   mySimulation = new SMESHGUI_MeshEditPreview(SMESH::GetViewWindow( mySMESHGUI ));
 
@@ -548,6 +549,7 @@ bool SMESHGUI_RevolutionDlg::ClickOnApply()
     }
 
     SMESH::UpdateView();
+    SMESH::Update(myIO, SMESH::eDisplay);
     if ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() )
       mySMESHGUI->updateObjBrowser(true); // new groups may appear
     Init(false);
@@ -575,19 +577,14 @@ void SMESHGUI_RevolutionDlg::ClickOnOk()
 //=================================================================================
 void SMESHGUI_RevolutionDlg::ClickOnCancel()
 {
-  disconnect(mySelectionMgr, 0, this, 0);
-  mySelectionMgr->clearFilters();
-  //mySelectionMgr->clearSelected();
-  if (SMESH::GetCurrentVtkView()) {
-    SMESH::RemoveFilters(); // PAL6938 -- clean all mesh entity filters
-    SMESH::SetPointRepresentation(false);
-  }
-  if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
-    aViewWindow->SetSelectionMode(ActorSelection);
-  mySMESHGUI->ResetState();
   reject();
 }
 
+void SMESHGUI_RevolutionDlg::reject()
+{
+  close();
+}
+
 //=================================================================================
 // function : ClickOnHelp()
 // purpose  :
@@ -688,7 +685,6 @@ void SMESHGUI_RevolutionDlg::SelectionIntoArgument()
   if (myBusy) return;
 
   // clear
-  myActor = 0;
   QString aString = "";
 
   myBusy = true;
@@ -711,20 +707,23 @@ void SMESHGUI_RevolutionDlg::SelectionIntoArgument()
     return;
 
   Handle(SALOME_InteractiveObject) IO = aList.First();
-  myMesh = SMESH::GetMeshByIO(IO);
-  if (myMesh->_is_nil())
+  SMESH::SMESH_Mesh_var aMeshVar = SMESH::GetMeshByIO(IO);
+  if (aMeshVar->_is_nil())
     return;
 
-  myActor = SMESH::FindActorByObject(myMesh);
-  if (!myActor)
-    myActor = SMESH::FindActorByEntry(IO->getEntry());
-  if (!myActor)
+  SMESH_Actor* anActor = SMESH::FindActorByObject(aMeshVar);
+  if (!anActor)
+    anActor = SMESH::FindActorByEntry(IO->getEntry());
+  if (!anActor)
     return;
 
   int aNbUnits = 0;
 
   if (myEditCurrentArgument == (QWidget*)LineEditElements) {
     myElementsId = "";
+    myMesh = aMeshVar;
+    myActor = anActor;
+    myIO = IO;
 
     // MakeGroups is available if there are groups
     if ( myMesh->NbGroups() == 0 ) {
@@ -750,7 +749,7 @@ void SMESHGUI_RevolutionDlg::SelectionIntoArgument()
     myNbOkElements = true;
   } else {
 
-    SMDS_Mesh* aMesh =  myActor->GetObject()->GetMesh();
+    SMDS_Mesh* aMesh = anActor->GetObject()->GetMesh();
     if (!aMesh)
       return;
 
@@ -839,7 +838,6 @@ void SMESHGUI_RevolutionDlg::SetEditCurrentArgument()
       mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter);
     } else {
       int aConstructorId = GetConstructorId();
-      myEditCurrentArgument = (QWidget*)SpinBox_X;
       if (aConstructorId == 0)
        {
          if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
@@ -913,17 +911,16 @@ void SMESHGUI_RevolutionDlg::enterEvent (QEvent*)
 void SMESHGUI_RevolutionDlg::closeEvent (QCloseEvent*)
 {
   /* same than click on cancel button */
-  ClickOnCancel();
-}
-
-//=======================================================================
-// function : hideEvent()
-// purpose  : caused by ESC key
-//=======================================================================
-void SMESHGUI_RevolutionDlg::hideEvent (QHideEvent*)
-{
-  if (!isMinimized())
-    ClickOnCancel();
+  disconnect(mySelectionMgr, 0, this, 0);
+  mySelectionMgr->clearFilters();
+  //mySelectionMgr->clearSelected();
+  if (SMESH::GetCurrentVtkView()) {
+    SMESH::RemoveFilters(); // PAL6938 -- clean all mesh entity filters
+    SMESH::SetPointRepresentation(false);
+  }
+  if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
+    aViewWindow->SetSelectionMode(ActorSelection);
+  mySMESHGUI->ResetState();
 }
 
 //=======================================================================
@@ -1127,6 +1124,8 @@ void SMESHGUI_RevolutionDlg::onSelectVectorMenu( QAction* action){
   if(!action)
     return;
 
+  disconnect(mySelectionMgr, 0, this, 0);
+
   switch(myMenuActions[action]) {
   case POINT_SELECT: 
     SMESH::SetPointRepresentation(true);
index f21974975fd6a02f34bcc1775ab6087ca9f8a41a..4d0c5169304e9b3b2bda2df6e85f9c063a219310 100644 (file)
@@ -29,6 +29,9 @@
 // SMESH includes
 #include "SMESH_SMESHGUI.hxx"
 
+// SALOME GUI includes
+#include <SALOME_InteractiveObject.hxx>
+
 // Qt includes
 #include <QDialog>
 #include <QMap>
@@ -70,13 +73,14 @@ public:
   SMESHGUI_RevolutionDlg( SMESHGUI* );
   ~SMESHGUI_RevolutionDlg();
 
+  void                      reject();
+
 private:
   enum {NONE_SELECT, POINT_SELECT, FACE_SELECT};
   
   void                      Init( bool = true);
   void                      closeEvent( QCloseEvent* );
   void                      enterEvent( QEvent* );           /* mouse enter the QWidget */
-  void                      hideEvent( QHideEvent* );        /* ESC key */
   void                      keyPressEvent( QKeyEvent* );
   int                       GetConstructorId();
   bool                      IsAxisOk();
@@ -90,6 +94,7 @@ private:
   QString                   myElementsId;
   QWidget*                  myEditCurrentArgument;   /* Current  argument */
   SVTK_Selector*            mySelector;
+  Handle(SALOME_InteractiveObject) myIO;
   
   SMESH::SMESH_IDSource_var mySelectedObject;