Salome HOME
Dump Image data to python script (Feature #13).
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_VisualStateOp.cxx
index dd0523aaaee3baed98c9a5aaf64b85901aa02f36..90a798286e873c0dc126226fd1588e4ec939a109 100644 (file)
@@ -59,6 +59,9 @@ void HYDROGUI_VisualStateOp::startOperation()
 {
   HYDROGUI_Operation::startOperation();
 
+  if( !myIsLoad )
+    startDocOperation();
+
   bool aResult = false;
   if( myIsLoad )
     aResult = loadVisualState();
@@ -66,9 +69,17 @@ void HYDROGUI_VisualStateOp::startOperation()
     aResult = saveVisualState();
 
   if( aResult )
+  {
+    if( !myIsLoad )
+      commitDocOperation();
     commit();
+  }
   else
-    abort(); // do not commit the document command
+  {
+    if( !myIsLoad )
+      abortDocOperation();
+    abort();
+  }
 }
 
 bool HYDROGUI_VisualStateOp::saveVisualState()
@@ -132,7 +143,7 @@ bool HYDROGUI_VisualStateOp::saveVisualState()
             // Format: "Name|Visibility[|CoordX|CoordY]"
             QString aParameters = anObject->GetName();
 
-            int aVisibility = (int)anObject->IsVisible( aViewId );
+            int aVisibility = (int)( module()->isObjectVisible( aViewId, anObject ) );
             aParameters.append( QString( "|%1" ).arg( aVisibility ) );
 
             setVisualProperty( aPropertyMap, aViewerEntry, aParameters, true );
@@ -247,7 +258,7 @@ bool HYDROGUI_VisualStateOp::loadVisualState()
               {
                 bool anIsVisible = aParameters[ aParamIndex ].toInt( &anIsOk[ ++aParamIndex ] );
                 if( anIsOk[ 0 ] )
-                  anObject->SetVisible( aViewId, anIsVisible );
+                  module()->setObjectVisible( aViewId, anObject, anIsVisible );
               }
             }
           }