]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Restore show trihedron on viewer creation
authorvsv <vitaly.smetannikov@opencascade.com>
Tue, 19 May 2015 16:29:29 +0000 (19:29 +0300)
committervsv <vitaly.smetannikov@opencascade.com>
Tue, 19 May 2015 16:29:29 +0000 (19:29 +0300)
src/ModuleBase/ModuleBase_Operation.cpp
src/ModuleBase/ModuleBase_Operation.h

index b934df13061c2bd6e6d74c9d1465c85e3ca809a2..ba66473b51c2bbc00ae832eb5c53a06bb93edd7e 100644 (file)
@@ -131,7 +131,7 @@ void ModuleBase_Operation::start()
 {
   QString anId = getDescription()->operationId();
   if (myIsEditing) {
-      anId = anId.append(EditSuffix());
+    anId = anId.append(EditSuffix());
   }
   ModelAPI_Session::get()->startOperation(anId.toStdString());
 
@@ -146,6 +146,13 @@ void ModuleBase_Operation::start()
       return;
     }
   }
+  /// Set current feature and remeber old current feature
+  if (myIsEditing) {
+    SessionPtr aMgr = ModelAPI_Session::get();
+    DocumentPtr aDoc = aMgr->activeDocument();
+    myCurrentFeature = aDoc->currentFeature(true);
+    aDoc->setCurrentFeature(feature(), false);
+  }
 
   startOperation();
   emit started();
@@ -166,6 +173,12 @@ void ModuleBase_Operation::resume()
 
 void ModuleBase_Operation::abort()
 {
+  if (myIsEditing) {
+    SessionPtr aMgr = ModelAPI_Session::get();
+    DocumentPtr aDoc = aMgr->activeDocument();
+    aDoc->setCurrentFeature(myCurrentFeature, true);
+    myCurrentFeature = FeaturePtr();
+  }
   abortOperation();
   emit aborted();
 
@@ -178,6 +191,13 @@ void ModuleBase_Operation::abort()
 bool ModuleBase_Operation::commit()
 {
   if (canBeCommitted()) {
+    /// Set current feature and remeber old current feature
+    if (myIsEditing) {
+      SessionPtr aMgr = ModelAPI_Session::get();
+      DocumentPtr aDoc = aMgr->activeDocument();
+      aDoc->setCurrentFeature(myCurrentFeature, true);
+      myCurrentFeature = FeaturePtr();
+    }
     commitOperation();
     // check whether there are modifications performed during the current operation
     // in the model
index c453e6b0616196a613694f90c9cd55214308dc3e..97e742eae9d3e346154ac63feb2c6043ab196486 100644 (file)
@@ -264,6 +264,8 @@ signals:
   /// before operation feature creating
   CompositeFeaturePtr myParentFeature;  
 
+  /// Last current feature before editing operation
+  FeaturePtr myCurrentFeature;
 };
 
 #endif