Salome HOME
#1109 Sketch entities preview red lines stayed in the viewer after Sketch is applyed.
authornds <nds@opencascade.com>
Tue, 8 Dec 2015 15:57:38 +0000 (18:57 +0300)
committernds <nds@opencascade.com>
Tue, 8 Dec 2015 15:57:38 +0000 (18:57 +0300)
src/ModuleBase/ModuleBase_IModule.h
src/PartSet/PartSet_Module.cpp
src/PartSet/PartSet_Module.h
src/XGUI/XGUI_OperationMgr.cpp

index 11e7949cfaf5e5e3de153dcda2f2e11a263eea0b..acd6b49acef50c0332d35978bfdaf2c63b38693b 100755 (executable)
@@ -212,6 +212,14 @@ class MODULEBASE_EXPORT ModuleBase_IModule : public QObject
   /// \param thePreviousAttributeID an index of the previous active attribute\r
   virtual bool processEnter(const std::string& thePreviousAttributeID) { return false; };\r
 \r
+  /// Performs some GUI actions after an operation transaction is opened\r
+  /// Default realization is empty\r
+  virtual void beforeOperationStarted(ModuleBase_Operation* theOperation) {};\r
+\r
+  /// Performs some GUI actions before an operation transaction is stopped\r
+  /// Default realization is empty\r
+  virtual void beforeOperationStopped(ModuleBase_Operation* theOperation) {};\r
+\r
 signals:\r
   /// Signal which is emitted when operation is launched\r
   void operationLaunched();\r
index 9b380a839de031128e1b0311af90b67a7373f389..1f0598bb4a50a5d0f101c174f1ebb67509e874a0 100755 (executable)
@@ -275,19 +275,16 @@ void PartSet_Module::operationStopped(ModuleBase_Operation* theOperation)
 {
   bool isModified = myCustomPrs->deactivate(false);
 
-  if (PartSet_SketcherMgr::isSketchOperation(theOperation)) {
-    mySketchMgr->stopSketch(theOperation);
-  }
-  else if (PartSet_SketcherMgr::isNestedSketchOperation(theOperation)) {
+  if (PartSet_SketcherMgr::isNestedSketchOperation(theOperation)) {
     mySketchMgr->stopNestedSketch(theOperation);
   }
 
   //VSV: Viewer is updated on feature update and redisplay
-  //if (isModified) {
-  //  XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(myWorkshop);
-  //  XGUI_Displayer* aDisplayer = aConnector->workshop()->displayer();
-  //  aDisplayer->updateViewer();
-  //}
+  if (isModified) {
+    XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(myWorkshop);
+    XGUI_Displayer* aDisplayer = aConnector->workshop()->displayer();
+    aDisplayer->updateViewer();
+  }
   mySketchMgr->onShowConstraintsToggle(myHasConstraintShown);
 }
 
@@ -485,7 +482,6 @@ void PartSet_Module::onOperationActivatedByPreselection()
   if(anOperation && PartSet_SketcherMgr::isNestedSketchOperation(anOperation)) {
     // Set final definitions if they are necessary
     //propertyPanelDefined(aOperation);
-
     /// Commit sketcher operations automatically
     anOperation->commit();
   }
@@ -512,7 +508,7 @@ ModuleBase_ModelWidget* PartSet_Module::createWidgetByType(const std::string& th
     aPointWgt->setSketch(mySketchMgr->activeSketch());
     connect(aPointWgt, SIGNAL(vertexSelected()), sketchReentranceMgr(), SLOT(onVertexSelected()));
     aWgt = aPointWgt;
-  } else if (theType == "sketch-2dpoint_flyout_selector") {
+  }else if (theType == "sketch-2dpoint_flyout_selector") {
     PartSet_WidgetPoint2DFlyout* aPointWgt = new PartSet_WidgetPoint2DFlyout(theParent, aWorkshop,
                                                                  theWidgetApi, theParentId);
     aPointWgt->setSketch(mySketchMgr->activeSketch());
@@ -1024,6 +1020,18 @@ bool PartSet_Module::processEnter(const std::string& thePreviousAttributeID)
   return mySketchReentrantMgr->processEnter(thePreviousAttributeID);
 }
 
+//******************************************************
+void PartSet_Module::beforeOperationStarted(ModuleBase_Operation* theOperation)
+{
+}
+
+//******************************************************
+void PartSet_Module::beforeOperationStopped(ModuleBase_Operation* theOperation)
+{
+  if (PartSet_SketcherMgr::isSketchOperation(theOperation)) {
+    mySketchMgr->stopSketch(theOperation);
+  }
+}
 
 //******************************************************
 void PartSet_Module::onBooleanOperationChange(int theOperation)
index 470294bdb1dec44f8d84db4de4e6b31c33cbc577..f074786d33f30c8d1a9be9eaf39cf43253e53767 100755 (executable)
@@ -219,6 +219,14 @@ public:
   /// \param thePreviousAttributeID an index of the previous active attribute
   virtual bool processEnter(const std::string& thePreviousAttributeID);
 
+  /// Performs some GUI actions after an operation transaction is opened
+  /// Default realization is empty
+  virtual void beforeOperationStarted(ModuleBase_Operation* theOperation);
+
+  /// Performs some GUI actions before an operation transaction is stopped
+  /// Default realization is empty
+  virtual void beforeOperationStopped(ModuleBase_Operation* theOperation);
+
 public slots:
   /// Redefines the parent method in order to customize the next case:
   /// If the sketch nested operation is active and the presentation is not visualized in the viewer,
index 5d89fcab12801482af4688fbfb3b834f38e40623..9015698d582966f93ae001765259990786f6314e 100644 (file)
@@ -431,6 +431,9 @@ void XGUI_OperationMgr::onBeforeOperationStarted()
     qDebug(QString("\tdocument->currentFeature(false) = %1").arg(
             ModuleBase_Tools::objectInfo(ModelAPI_Session::get()->activeDocument()->currentFeature(false))).toStdString().c_str());
 #endif
+  ModuleBase_IModule* aModule = myWorkshop->module();
+  if (aModule)
+    aModule->beforeOperationStarted(aFOperation);
   }
 }
 
@@ -487,6 +490,9 @@ void XGUI_OperationMgr::onBeforeOperationCommitted()
     qDebug(QString("\tdocument->currentFeature(false) = %1").arg(
             ModuleBase_Tools::objectInfo(ModelAPI_Session::get()->activeDocument()->currentFeature(false))).toStdString().c_str());
 #endif
+    ModuleBase_IModule* aModule = myWorkshop->module();
+    if (aModule)
+      aModule->beforeOperationStopped(aFOperation);
   }
 }