]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Avoid redisplay of sketcher while it is not finished
authorvsv <vitaly.smetannikov@opencascade.com>
Wed, 23 Jul 2014 07:24:27 +0000 (11:24 +0400)
committervsv <vitaly.smetannikov@opencascade.com>
Wed, 23 Jul 2014 07:24:27 +0000 (11:24 +0400)
src/ModuleBase/ModuleBase_Operation.cpp
src/ModuleBase/ModuleBase_Operation.h
src/PartSet/PartSet_OperationSketchBase.cpp
src/XGUI/XGUI_Workshop.cpp

index e967a1d4918d7c855e4cf8a5353363873561d257..0387105b784b57acc96c4ddb5ce475f42b48692f 100644 (file)
@@ -16,6 +16,7 @@
 #include <ModelAPI_Data.h>
 #include <ModelAPI_Document.h>
 #include <ModelAPI_Events.h>
+#include <ModelAPI_Result.h>
 
 #include <Events_Loop.h>
 
@@ -69,7 +70,7 @@ void ModuleBase_Operation::onWidgetActivated(ModuleBase_ModelWidget* theWidget)
 void ModuleBase_Operation::startOperation()
 {
   if (!myIsEditing)
-    setFeature(createFeature());
+    createFeature();
   //emit callSlot();
   //commit();
 }
@@ -104,10 +105,10 @@ void ModuleBase_Operation::flushCreated()
 FeaturePtr ModuleBase_Operation::createFeature(const bool theFlushMessage)
 {
   boost::shared_ptr<ModelAPI_Document> aDoc = document();
-  FeaturePtr aFeature = aDoc->addFeature(getDescription()->operationId().toStdString());
-  if (aFeature) { // TODO: generate an error if feature was not created
+  myFeature = aDoc->addFeature(getDescription()->operationId().toStdString());
+  if (myFeature) { // TODO: generate an error if feature was not created
     myIsModified = true;
-    aFeature->execute();
+    myFeature->execute();
     // Init default values
     /*QList<ModuleBase_ModelWidget*> aWidgets = getDescription()->modelWidgets();
     QList<ModuleBase_ModelWidget*>::const_iterator anIt = aWidgets.begin(), aLast = aWidgets.end();
@@ -118,7 +119,7 @@ FeaturePtr ModuleBase_Operation::createFeature(const bool theFlushMessage)
 
   if (theFlushMessage)
     flushCreated();
-  return aFeature;
+  return myFeature;
 }
 
 void ModuleBase_Operation::setFeature(FeaturePtr theFeature)
@@ -131,3 +132,19 @@ void ModuleBase_Operation::setEditingFeature(FeaturePtr theFeature)
   setFeature(theFeature);
   myIsEditing = true;
 }
+
+bool ModuleBase_Operation::hasObject(ObjectPtr theObj) const
+{
+  FeaturePtr aFeature = feature();
+  if (aFeature) {
+    if (aFeature.get() == theObj.get())
+      return true;
+    std::list<ResultPtr> aResults = aFeature->results();
+    std::list<ResultPtr>::const_iterator aIt;
+    for (aIt = aResults.cbegin(); aIt != aResults.cend(); ++aIt) {
+      if ((*aIt).get() == theObj.get())
+        return true;
+    }
+  }
+  return false;
+}
\ No newline at end of file
index 6a95f0085d8e8305c342bbc20f4be0a518fa6f3c..ae2250624db9ad0c7fa94040b767abf69f65bfe8 100644 (file)
@@ -72,6 +72,9 @@ public:
   /// Sets the operation feature
   void setEditingFeature(FeaturePtr theFeature);
 
+  /// Returns True if the current operation works with the given object (feature or result)
+  virtual bool hasObject(ObjectPtr theObj) const;
+
 public slots:
   /// Slots which listen the mode widget activation
   /// \param theWidget the model widget
@@ -105,11 +108,11 @@ protected:
   /// \returns the created feature
   virtual FeaturePtr createFeature(const bool theFlushMessage = true);
 
-private:
+protected:
   /// Sets the operation feature
   void setFeature(FeaturePtr theFeature);
 
-private:
+protected:
   FeaturePtr myFeature; /// the operation feature to be handled
 };
 
index d82aae96b4d9ed8dcda9ba56ce72644cfe1c9bde..5934e46d198a112f713f7c7790e6cad444905525 100644 (file)
@@ -68,10 +68,10 @@ std::list<int> PartSet_OperationSketchBase::getSelectionModes(ObjectPtr theFeatu
 }
 FeaturePtr PartSet_OperationSketchBase::createFeature(const bool theFlushMessage)
 {
-  FeaturePtr aFeature = ModuleBase_Operation::createFeature(theFlushMessage);
-  if (aFeature)
-    emit featureConstructed(aFeature, FM_Activation);
-  return aFeature;
+  ModuleBase_Operation::createFeature(theFlushMessage);
+  if (myFeature)
+    emit featureConstructed(myFeature, FM_Activation);
+  return myFeature;
 }
 
 
index de4c5af919d48a6337f680b9781dd941724e5944..0ca48658f2fdde9b5e57a5016e1427497a5813ea 100644 (file)
@@ -330,8 +330,11 @@ void XGUI_Workshop::onFeatureCreatedMsg(const ModelAPI_ObjectUpdatedMessage* the
     if (aPart) {
       aHasPart = true;
     } else {
-      myDisplayer->display(*aIt, false);
-      isDisplayed = true;
+      ModuleBase_Operation* aOperation = myOperationMgr->currentOperation();
+      if (aOperation->hasObject(*aIt)) { // Display only current operation results
+        myDisplayer->display(*aIt, false);
+        isDisplayed = true;
+      }
     }
   }
   if (isDisplayed)