]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/XGUI/XGUI_ContextMenuMgr.cpp
Salome HOME
bos #29479 Show edges directions
[modules/shaper.git] / src / XGUI / XGUI_ContextMenuMgr.cpp
index 99e9bc0fb6dba8d4038cf08a26e957e28e38482a..e42131d55865497631ec136d9cc1000517deb9ba 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2021  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2022  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -111,6 +111,10 @@ void XGUI_ContextMenuMgr::createActions()
   addAction("MOVE_SPLIT_CMD", anAction);
 #endif
 
+  anAction = ModuleBase_Tools::createAction(QIcon(":pictures/recover.png"),
+    tr("Recover"), this);
+  addAction("RECOVER_CMD", anAction);
+
   anAction = ModuleBase_Tools::createAction(QIcon(":pictures/clean_history.png"),
                                            tr("Clean history"), aDesktop);
   addAction("CLEAN_HISTORY_CMD", anAction);
@@ -153,6 +157,11 @@ void XGUI_ContextMenuMgr::createActions()
                                            aDesktop);
   addAction("WIREFRAME_CMD", anAction);
 
+  anAction = ModuleBase_Tools::createAction(QIcon(":pictures/edges_dir.png"), tr("Show edges direction"),
+                                           aDesktop);
+  anAction->setCheckable(true);
+  addAction("SHOW_EDGES_DIRECTION_CMD", anAction);
+
   anAction = ModuleBase_Tools::createAction(QIcon(":pictures/iso_lines.png"), tr("Define Isos..."),
                                            aDesktop);
   addAction("ISOLINES_CMD", anAction);
@@ -336,6 +345,9 @@ void XGUI_ContextMenuMgr::updateObjectBrowserMenu()
             action("WIREFRAME_CMD")->setEnabled(true);
             action("SHADING_CMD")->setEnabled(true);
           }
+          action("SHOW_EDGES_DIRECTION_CMD")->setEnabled(true);
+          action("SHOW_EDGES_DIRECTION_CMD")->setChecked(ModelAPI_Tools::isShowEdgesDirection(aResult));
+
           action("SHOW_ISOLINES_CMD")->setEnabled(true);
           action("SHOW_ISOLINES_CMD")->setChecked(ModelAPI_Tools::isShownIsoLines(aResult));
           action("ISOLINES_CMD")->setEnabled(true);
@@ -362,6 +374,18 @@ void XGUI_ContextMenuMgr::updateObjectBrowserMenu()
           action("MOVE_SPLIT_CMD")->setEnabled(true);
         }
 #endif
+        if (hasFeature && aObject->document() != aMgr->moduleDocument() &&
+            aObject->document() == aMgr->activeDocument())
+        {
+          XGUI_OperationMgr* anOperationMgr = myWorkshop->operationMgr();
+          if (!anOperationMgr->hasOperation()) {
+            FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aObject);
+            std::list<std::shared_ptr<ModelAPI_Result> > aResults;
+            ModelAPI_Tools::getConcealedResults(aFeature, aResults);
+            if (!aResults.empty()) // check the feature conceals at least one result
+              action("RECOVER_CMD")->setEnabled(true);
+          }
+        }
 
         if( aMgr->activeDocument() == aObject->document() )
         {
@@ -380,6 +404,7 @@ void XGUI_ContextMenuMgr::updateObjectBrowserMenu()
         action("SHOW_ONLY_CMD")->setEnabled(true);
         action("SHADING_CMD")->setEnabled(true);
         action("WIREFRAME_CMD")->setEnabled(true);
+        action("SHOW_EDGES_DIRECTION_CMD")->setEnabled(true);
         action("SHOW_ISOLINES_CMD")->setEnabled(true);
         action("ISOLINES_CMD")->setEnabled(true);
       }
@@ -574,6 +599,10 @@ void XGUI_ContextMenuMgr::updateViewerMenu()
           if (aResult.get()) {
             action("SHOW_ISOLINES_CMD")->setEnabled(true);
             action("SHOW_ISOLINES_CMD")->setChecked(ModelAPI_Tools::isShownIsoLines(aResult));
+
+            action("SHOW_EDGES_DIRECTION_CMD")->setEnabled(true);
+            action("SHOW_EDGES_DIRECTION_CMD")->setChecked(
+              ModelAPI_Tools::isShowEdgesDirection(aResult));
           }
         }
       }
@@ -680,6 +709,7 @@ void XGUI_ContextMenuMgr::buildObjBrowserMenu()
   aList.clear();
   aList.append(action("WIREFRAME_CMD"));
   aList.append(action("SHADING_CMD"));
+  aList.append(action("SHOW_EDGES_DIRECTION_CMD"));
   aList.append(mySeparator1); // this separator is not shown as this action is added after show only
   // qt list container contains only one instance of the same action
   aList.append(action("SHOW_CMD"));
@@ -704,6 +734,7 @@ void XGUI_ContextMenuMgr::buildObjBrowserMenu()
   aList.clear();
   aList.append(action("WIREFRAME_CMD"));
   aList.append(action("SHADING_CMD"));
+  aList.append(action("SHOW_EDGES_DIRECTION_CMD"));
   aList.append(mySeparator1); // this separator is not shown as this action is added after show only
   // qt list container contains only one instance of the same action
   aList.append(action("SHOW_CMD"));
@@ -729,6 +760,7 @@ void XGUI_ContextMenuMgr::buildObjBrowserMenu()
   aList.append(action("SHOW_RESULTS_CMD"));
   aList.append(action("MOVE_CMD"));
   aList.append(action("MOVE_SPLIT_CMD"));
+  aList.append(action("RECOVER_CMD"));
   aList.append(mySeparator1);
   aList.append(action("INSERT_FOLDER_CMD"));
   aList.append(action("ADD_TO_FOLDER_BEFORE_CMD"));
@@ -784,6 +816,7 @@ void XGUI_ContextMenuMgr::buildViewerMenu()
   aList.clear();
   aList.append(action("WIREFRAME_CMD"));
   aList.append(action("SHADING_CMD"));
+  aList.append(action("SHOW_EDGES_DIRECTION_CMD"));
   aList.append(mySeparator2);
   aList.append(action("COLOR_CMD"));
   aList.append(action("DEFLECTION_CMD"));
@@ -828,6 +861,7 @@ void XGUI_ContextMenuMgr::addObjBrowserMenu(QMenu* theMenu) const
   } else if (aSelected > 1) {
       anActions.append(action("WIREFRAME_CMD"));
       anActions.append(action("SHADING_CMD"));
+      anActions.append(action("SHOW_EDGES_DIRECTION_CMD"));
       anActions.append(mySeparator1);
       anActions.append(action("SHOW_CMD"));
       anActions.append(action("HIDE_CMD"));