Salome HOME
patch for correct bathymetry visualization in HYDRO
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_ZLevelsOp.cxx
index 87dc49ee48bc88928d93745bf8267b58212ed770..3f7c1eaf732e55ca72ae2f5dbaee49911b2edf11 100644 (file)
@@ -42,7 +42,7 @@
 */
 HYDROGUI_ZLevelsOp::HYDROGUI_ZLevelsOp( HYDROGUI_Module* theModule )
 : HYDROGUI_Operation( theModule ),
-  myZLevelsDlg( NULL )
+  myDlg( NULL )
 {
   setName( tr( "SET_Z_LEVELS" ) );
 }
@@ -82,28 +82,28 @@ void HYDROGUI_ZLevelsOp::startOperation()
   }
 
   // Show the dialog
-  if ( !myZLevelsDlg ) {
-    //TODO: delete dialog each time?
-    myZLevelsDlg = new HYDROGUI_ZLevelsDlg( module()->getApp()->desktop(), module() );
-    connect( myZLevelsDlg, SIGNAL( applyOrder() ), this, SLOT( onApply() ) );
-    connect( myZLevelsDlg, SIGNAL( rejected() ), this, SLOT( onCancel() ) );
+  if ( !myDlg ) {
+    myDlg = new HYDROGUI_ZLevelsDlg( module()->getApp()->desktop(), module() );
+    connect( myDlg, SIGNAL( applyOrder() ), this, SLOT( onApply() ) );
+    connect( myDlg, SIGNAL( rejected() ), this, SLOT( onCancel() ) );
   }
-  myZLevelsDlg->setObjects( anObject2VisibleList );
+  myDlg->setObjects( anObject2VisibleList );
 
-  myZLevelsDlg->exec();
+  myDlg->exec();
 }
 
 /**
 */
 bool HYDROGUI_ZLevelsOp::processApply( int& theUpdateFlags,
-                                       QString& theErrorMsg )
+                                       QString& theErrorMsg,
+                                       QStringList& theBrowseObjectsEntries )
 {
   bool aRes = false;
 
-  if ( myZLevelsDlg ) {
+  if ( myDlg ) {
     Handle(HYDROData_Document) aDoc = doc();
     if( !aDoc.IsNull() ) {
-      HYDROGUI_ListModel::ObjectList anObjects = myZLevelsDlg->getObjects();
+      HYDROGUI_ListModel::ObjectList anObjects = myDlg->getObjects();
       HYDROData_SequenceOfObjects anOrderedObjects;
       foreach ( const Handle(HYDROData_Entity) anObject, anObjects ) {
         anOrderedObjects.Append( anObject );
@@ -111,7 +111,7 @@ bool HYDROGUI_ZLevelsOp::processApply( int& theUpdateFlags,
 
       aDoc->SetObjectsLayerOrder( anOrderedObjects );
 
-      theUpdateFlags = UF_Model | UF_OCCViewer | UF_OCC_Forced;
+      theUpdateFlags = UF_Model | UF_OCCViewer;
       aRes = true;
     }
   }
@@ -119,3 +119,20 @@ bool HYDROGUI_ZLevelsOp::processApply( int& theUpdateFlags,
   return aRes;
 }
 
+/**
+*/
+bool HYDROGUI_ZLevelsOp::isGranted() const
+{
+  return true;
+}
+
+/**
+*/
+void HYDROGUI_ZLevelsOp::processCancel()
+{
+  // Delete the dialog
+  if ( myDlg ) {
+    delete myDlg;
+    myDlg = 0;
+  }
+}
\ No newline at end of file