]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
added the "Bring To Front" command for Groups mbs/display
authormbs <martin.bernhard@opencascade.com>
Wed, 4 Jan 2023 20:11:22 +0000 (20:11 +0000)
committermbs <martin.bernhard@opencascade.com>
Wed, 4 Jan 2023 20:11:22 +0000 (20:11 +0000)
14 files changed:
src/Model/Model_Data.cpp
src/ModelAPI/ModelAPI_Result.cpp
src/ModelAPI/ModelAPI_Result.h
src/ModelAPI/ModelAPI_Tools.cpp
src/ModelAPI/ModelAPI_Tools.h
src/ModuleBase/ModuleBase_Tools.cpp
src/ModuleBase/ModuleBase_Tools.h
src/PartSet/PartSet_Module.cpp
src/XGUI/XGUI_ContextMenuMgr.cpp
src/XGUI/XGUI_ContextMenuMgr.h
src/XGUI/XGUI_Displayer.cpp
src/XGUI/XGUI_Workshop.cpp
src/XGUI/XGUI_Workshop.h
src/XGUI/XGUI_msg_fr.ts

index 00e6defd2e6566b00481ceb52d2c24f8ec0abb8e..096f015f15ef522732f0438204a8d123697af848 100644 (file)
@@ -466,7 +466,7 @@ void Model_Data::sendAttributeUpdated(ModelAPI_Attribute* theAttr)
     if (myObject && (theAttr->attributeType() == "Point2D" || theAttr->id() == "Color" ||
       theAttr->id() == "Transparency" || theAttr->id() == "Deflection" ||
       theAttr->id() == "Iso_lines" || theAttr->id() == "Show_Iso_lines" ||
-      theAttr->id() == "Show_Edges_direction")) {
+      theAttr->id() == "Show_Edges_direction" || theAttr->id() == "Bring_To_Front")) {
       static const Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY);
       ModelAPI_EventCreator::get()->sendUpdated(myObject, anEvent);
     }
index a225fe95032bbf12e231d7845927c76b50c86603..04632b4ea7798ad717c964cff8c8f23de627a87d 100644 (file)
@@ -39,10 +39,11 @@ void ModelAPI_Result::initAttributes()
   aData->addAttribute(DEFLECTION_ID(), ModelAPI_AttributeDouble::typeId())->setIsArgument(false);
   aData->addAttribute(TRANSPARENCY_ID(), ModelAPI_AttributeDouble::typeId())->setIsArgument(false);
   aData->addAttribute(ISO_LINES_ID(), ModelAPI_AttributeIntArray::typeId())->setIsArgument(false);
-  aData->addAttribute(SHOW_ISO_LINES_ID(), ModelAPI_AttributeBoolean::typeId())->
-    setIsArgument(false);
-  aData->addAttribute(SHOW_EDGES_DIRECTION_ID(), ModelAPI_AttributeBoolean::typeId())->
-    setIsArgument(false);
+  aData->addAttribute(SHOW_ISO_LINES_ID(), ModelAPI_AttributeBoolean::typeId())->setIsArgument(false);
+  aData->addAttribute(SHOW_EDGES_DIRECTION_ID(), ModelAPI_AttributeBoolean::typeId())->setIsArgument(false);
+  // Add the "Bring To Front" attribute to the Result base class, as we may support it in the future
+  // for all type of results. Actually, only ResultGroups are supported.
+  aData->addAttribute(BRING_TO_FRONT_ID(), ModelAPI_AttributeBoolean::typeId())->setIsArgument(false);
 }
 
 bool ModelAPI_Result::setDisabled(std::shared_ptr<ModelAPI_Result> theThis, const bool theFlag)
index 778529c221b0ae2d34b4ec84f7b51af32e138765..88caeb55c66528cd34a805c0187af334f40f3c43 100644 (file)
@@ -87,6 +87,14 @@ class ModelAPI_Result : public ModelAPI_Object
     return MY_SHOW_EDGES_DIRECTION_ID;
   }
 
+  /// Reference to the BringToFront flag of the result.
+  /// The bool value is used.
+  inline static const std::string& BRING_TO_FRONT_ID()
+  {
+    static const std::string MY_BRING_TO_FRONT_ID("Bring_To_Front");
+    return MY_BRING_TO_FRONT_ID;
+  }
+
   /// Returns true if the result is concealed from the data tree (referenced by other objects)
   MODELAPI_EXPORT virtual bool isConcealed();
 
index 84c5de685d83c7cbd6a5c7ba02dbd1f12639865b..2c2a9b654e97f4ea0248004f355a89b98e3dc236 100644 (file)
@@ -1194,6 +1194,31 @@ bool isShowEdgesDirection(std::shared_ptr<ModelAPI_Result> theResult)
   return false;
 }
 
+//******************************************************
+void bringToFront(std::shared_ptr<ModelAPI_Result> theResult, bool theFlag)
+{
+  if (!theResult.get())
+    return;
+
+  AttributeBooleanPtr aAttr = theResult->data()->boolean(ModelAPI_Result::BRING_TO_FRONT_ID());
+  if (aAttr.get() != NULL) {
+    aAttr->setValue(theFlag);
+  }
+}
+
+//******************************************************
+bool isBringToFront(std::shared_ptr<ModelAPI_Result> theResult)
+{
+  if (!theResult.get())
+    return false;
+
+  AttributeBooleanPtr aAttr = theResult->data()->boolean(ModelAPI_Result::BRING_TO_FRONT_ID());
+  if (aAttr.get() != NULL) {
+    return aAttr->value();
+  }
+  return false;
+}
+
 //**************************************************************
 void setTransparency(ResultPtr theResult, double theTransparency)
 {
index 83a1e010ef4a0e9676105322008018e9d0ffc829..8a2e7eec15627aeecd1160c0a19b329b8c00689a 100644 (file)
@@ -312,6 +312,14 @@ MODELAPI_EXPORT void showEdgesDirection(std::shared_ptr<ModelAPI_Result> theResu
 
 MODELAPI_EXPORT bool isShowEdgesDirection(std::shared_ptr<ModelAPI_Result> theResult);
 
+/*! Set flag to bring result in front of other results
+* \param[in] theResult a result object
+* \param[in] theFlag is a flag
+*/
+MODELAPI_EXPORT void bringToFront(std::shared_ptr<ModelAPI_Result> theResult, bool theFlag);
+
+MODELAPI_EXPORT bool isBringToFront(std::shared_ptr<ModelAPI_Result> theResult);
+
 /*! Returns current transparency in the given result
 * \param theResult a result object
 * \return a transparency value or -1 if it was not defined
index 2245d51e0a2045469d80a4a05aa44b3ede228342..60c1bb579c72a8f7f22a1fedcfb1201e7baea640 100644 (file)
@@ -446,7 +446,7 @@ int shapeType(const QString& theType)
 
 void checkObjects(const QObjectPtrList& theObjects, bool& hasResult, bool& hasFeature,
                   bool& hasParameter, bool& hasCompositeOwner, bool& hasResultInHistory,
-                  bool& hasFolder)
+                  bool& hasFolder, bool &hasGroupsOnly)
 {
   hasResult = false;
   hasFeature = false;
@@ -454,9 +454,11 @@ void checkObjects(const QObjectPtrList& theObjects, bool& hasResult, bool& hasFe
   hasCompositeOwner = false;
   hasResultInHistory = false;
   hasFolder = false;
+  bool hasNonGroup = false;
   foreach(ObjectPtr aObj, theObjects) {
     FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aObj);
     ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(aObj);
+    ResultGroupPtr aGroup = std::dynamic_pointer_cast<ModelAPI_ResultGroup>(aObj);
     FolderPtr aFolder = std::dynamic_pointer_cast<ModelAPI_Folder>(aObj);
     ResultParameterPtr aConstruction = std::dynamic_pointer_cast<ModelAPI_ResultParameter>(aResult);
     FieldStepPtr aStep = std::dynamic_pointer_cast<ModelAPI_ResultField::ModelAPI_FieldStep>(aObj);
@@ -465,6 +467,7 @@ void checkObjects(const QObjectPtrList& theObjects, bool& hasResult, bool& hasFe
     hasFeature |= (aFeature.get() != NULL);
     hasFolder |= (aFolder.get() != NULL);
     hasParameter |= (aConstruction.get() != NULL);
+    hasNonGroup |= (aGroup.get() == NULL);
     if (hasFeature)
       hasCompositeOwner |= (ModelAPI_Tools::compositeOwner(aFeature) != NULL);
     else if (aResult.get())
@@ -475,9 +478,10 @@ void checkObjects(const QObjectPtrList& theObjects, bool& hasResult, bool& hasFe
       hasResultInHistory = aFeature.get() && aFeature->isInHistory();
     }
 
-    if (hasFeature && hasResult  && hasParameter && hasCompositeOwner)
+    if (hasFeature && hasResult && hasParameter && hasCompositeOwner && hasNonGroup)
       break;
   }
+  hasGroupsOnly = !hasNonGroup;
 }
 
 void setDefaultDeviationCoefficient(const TopoDS_Shape& theShape,
index d3f1914fe6cec42840df825f5e7de3c813dc9c2a..d5be417eca815c6ff1e6e72de0fdb1a72bea4b0c 100644 (file)
@@ -189,7 +189,7 @@ MODULEBASE_EXPORT bool isSubResult(ObjectPtr theObject);
 /// \param hasFolder will be set to true if one of folder is in the list
 MODULEBASE_EXPORT void checkObjects(const QObjectPtrList& theObjects, bool& hasResult,
                            bool& hasFeature, bool& hasParameter, bool& hasCompositeOwner,
-                           bool& hasResultInHistory, bool& hasFolder);
+                           bool& hasResultInHistory, bool& hasFolder, bool &hasGroupsOnly);
 
 /// Sets the default coeffient into the driver calculated accordingly the shape type.
 /// It provides 1.e-4 for results of construction type
index eb8cf55898e2dcd9c587995dedc32b5e03e74232..76bafe5f6b1cc2c22eadd5b143e0120c2a7e6684 100644 (file)
@@ -1598,8 +1598,9 @@ void PartSet_Module::addObjectBrowserMenu(QMenu* theMenu) const
   bool hasCompositeOwner = false;
   bool hasResultInHistory = false;
   bool hasFolder = false;
+  bool hasGroupsOnly = false;
   ModuleBase_Tools::checkObjects(aObjects, hasResult, hasFeature, hasParameter,
-                                  hasCompositeOwner, hasResultInHistory, hasFolder);
+                                  hasCompositeOwner, hasResultInHistory, hasFolder, hasGroupsOnly);
 
   ModuleBase_Operation* aCurrentOp = myWorkshop->currentOperation();
   if (aSelected == 1) {
index e42131d55865497631ec136d9cc1000517deb9ba..49c2a4d0d3b2f2ff6e77f40409a8429ddc425e2e 100644 (file)
@@ -170,6 +170,10 @@ void XGUI_ContextMenuMgr::createActions()
   anAction->setCheckable(true);
   addAction("SHOW_ISOLINES_CMD", anAction);
 
+  anAction = ModuleBase_Tools::createAction(QIcon(), tr("Bring To Front"), aDesktop);
+  anAction->setCheckable(true);
+  addAction("BRING_TO_FRONT_CMD", anAction);
+
   mySeparator1 = ModuleBase_Tools::createAction(QIcon(), "", aDesktop);
   mySeparator1->setSeparator(true);
 
@@ -179,6 +183,9 @@ void XGUI_ContextMenuMgr::createActions()
   mySeparator3 = ModuleBase_Tools::createAction(QIcon(), "", aDesktop);
   mySeparator3->setSeparator(true);
 
+  mySeparator4 = ModuleBase_Tools::createAction(QIcon(), "", aDesktop);
+  mySeparator4->setSeparator(true);
+
   anAction = ModuleBase_Tools::createAction(QIcon(":pictures/vertex.png"), tr("Vertices"), aDesktop,
                                            this, SLOT(onShapeSelection(bool)));
   anAction->setCheckable(true);
@@ -327,8 +334,9 @@ void XGUI_ContextMenuMgr::updateObjectBrowserMenu()
     bool hasCompositeOwner = false;
     bool hasResultInHistory = false;
     bool hasFolder = false;
+    bool hasGroupsOnly = false;
     ModuleBase_Tools::checkObjects(aObjects, hasResult, hasFeature, hasParameter,
-                                   hasCompositeOwner, hasResultInHistory, hasFolder);
+                                   hasCompositeOwner, hasResultInHistory, hasFolder, hasGroupsOnly);
     //Process Feature
     if (aSelected == 1) { // single selection
       ObjectPtr aObject = aObjects.first();
@@ -348,6 +356,9 @@ void XGUI_ContextMenuMgr::updateObjectBrowserMenu()
           action("SHOW_EDGES_DIRECTION_CMD")->setEnabled(true);
           action("SHOW_EDGES_DIRECTION_CMD")->setChecked(ModelAPI_Tools::isShowEdgesDirection(aResult));
 
+          action("BRING_TO_FRONT_CMD")->setEnabled(hasGroupsOnly);
+          action("BRING_TO_FRONT_CMD")->setChecked(ModelAPI_Tools::isBringToFront(aResult));
+
           action("SHOW_ISOLINES_CMD")->setEnabled(true);
           action("SHOW_ISOLINES_CMD")->setChecked(ModelAPI_Tools::isShownIsoLines(aResult));
           action("ISOLINES_CMD")->setEnabled(true);
@@ -405,6 +416,7 @@ void XGUI_ContextMenuMgr::updateObjectBrowserMenu()
         action("SHADING_CMD")->setEnabled(true);
         action("WIREFRAME_CMD")->setEnabled(true);
         action("SHOW_EDGES_DIRECTION_CMD")->setEnabled(true);
+        action("BRING_TO_FRONT_CMD")->setEnabled(hasGroupsOnly);
         action("SHOW_ISOLINES_CMD")->setEnabled(true);
         action("ISOLINES_CMD")->setEnabled(true);
       }
@@ -603,6 +615,11 @@ void XGUI_ContextMenuMgr::updateViewerMenu()
             action("SHOW_EDGES_DIRECTION_CMD")->setEnabled(true);
             action("SHOW_EDGES_DIRECTION_CMD")->setChecked(
               ModelAPI_Tools::isShowEdgesDirection(aResult));
+
+            // Only enable the "Bring To Front" command for Groups
+            ResultGroupPtr aGroup = std::dynamic_pointer_cast<ModelAPI_ResultGroup>(aResult);
+            action("BRING_TO_FRONT_CMD")->setEnabled(aGroup.get() != NULL);
+            action("BRING_TO_FRONT_CMD")->setChecked(ModelAPI_Tools::isBringToFront(aResult));
           }
         }
       }
@@ -690,6 +707,7 @@ void XGUI_ContextMenuMgr::buildObjBrowserMenu()
 
   QActionsList aList;
 
+  //-------------------------------------
   // Result construction menu
   aList.append(action("SHOW_CMD"));
   aList.append(action("HIDE_CMD"));
@@ -705,7 +723,7 @@ void XGUI_ContextMenuMgr::buildObjBrowserMenu()
   myObjBrowserMenus[ModelAPI_ResultConstruction::group()] = aList;
 
   //-------------------------------------
-  // Result body menu
+  // Result body/field/part menu
   aList.clear();
   aList.append(action("WIREFRAME_CMD"));
   aList.append(action("SHADING_CMD"));
@@ -725,22 +743,26 @@ void XGUI_ContextMenuMgr::buildObjBrowserMenu()
   aList.append(action("SHOW_FEATURE_CMD"));
   aList.append(mySeparator3);
   aList.append(action("DELETE_CMD"));
+  // Result body menu
   myObjBrowserMenus[ModelAPI_ResultBody::group()] = aList;
-  // Group menu
+  // Field menu
   myObjBrowserMenus[ModelAPI_ResultField::group()] = aList;
   // Result part menu
   myObjBrowserMenus[ModelAPI_ResultPart::group()] = aList;
 
+  //-------------------------------------
+  // Group menu
   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(mySeparator1);
+  aList.append(action("BRING_TO_FRONT_CMD"));
+  aList.append(mySeparator2);
   aList.append(action("SHOW_CMD"));
   aList.append(action("HIDE_CMD"));
   aList.append(action("SHOW_ONLY_CMD"));
-  aList.append(mySeparator2);
+  aList.append(mySeparator3);
   aList.append(action("AUTOCOLOR_CMD"));
   aList.append(action("RENAME_CMD"));
   aList.append(action("COLOR_CMD"));
@@ -749,10 +771,10 @@ void XGUI_ContextMenuMgr::buildObjBrowserMenu()
   aList.append(action("SHOW_ISOLINES_CMD"));
   aList.append(action("ISOLINES_CMD"));
   aList.append(action("SHOW_FEATURE_CMD"));
-  aList.append(mySeparator3);
+  aList.append(mySeparator4);
   aList.append(action("DELETE_CMD"));
-  // Group menu
   myObjBrowserMenus[ModelAPI_ResultGroup::group()] = aList;
+
   //-------------------------------------
   // Feature menu
   aList.clear();
@@ -773,14 +795,17 @@ void XGUI_ContextMenuMgr::buildObjBrowserMenu()
   aList.append(action("DELETE_CMD"));
   myObjBrowserMenus[ModelAPI_Feature::group()] = aList;
 
+  //-------------------------------------
+  // Parameter menu
   aList.clear();
   aList.append(action("RENAME_CMD"));
   aList.append(mySeparator1);
   aList.append(action("CLEAN_HISTORY_CMD"));
   aList.append(action("DELETE_CMD"));
   myObjBrowserMenus[ModelAPI_ResultParameter::group()] = aList;
-  //-------------------------------------
 
+  //-------------------------------------
+  // Folder menu
   aList.clear();
   aList.append(action("RENAME_CMD"));
   aList.append(action("DELETE_CMD"));
@@ -798,7 +823,7 @@ void XGUI_ContextMenuMgr::buildObjBrowserMenu()
 void XGUI_ContextMenuMgr::buildViewerMenu()
 {
   QActionsList aList;
-  // Result construction menu
+  // Result construction/part menu
   aList.append(action("COLOR_CMD"));
   aList.append(action("DEFLECTION_CMD"));
   aList.append(action("TRANSPARENCY_CMD"));
@@ -809,8 +834,8 @@ void XGUI_ContextMenuMgr::buildViewerMenu()
   aList.append(action("SHOW_ONLY_CMD"));
   aList.append(action("HIDE_CMD"));
   myViewerMenu[ModelAPI_ResultConstruction::group()] = aList;
-  // Result part menu
   myViewerMenu[ModelAPI_ResultPart::group()] = aList;
+
   //-------------------------------------
   // Result body menu
   aList.clear();
@@ -830,9 +855,30 @@ void XGUI_ContextMenuMgr::buildViewerMenu()
   aList.append(action("SHOW_ONLY_CMD"));
   aList.append(action("HIDE_CMD"));
   myViewerMenu[ModelAPI_ResultBody::group()] = aList;
+  myViewerMenu[ModelAPI_ResultField::group()] = aList;
+
+  //-------------------------------------
   // Group menu
+  aList.clear();
+  aList.append(action("WIREFRAME_CMD"));
+  aList.append(action("SHADING_CMD"));
+  aList.append(action("SHOW_EDGES_DIRECTION_CMD"));
+  aList.append(mySeparator1);
+  aList.append(action("BRING_TO_FRONT_CMD"));
+  aList.append(mySeparator2);
+  aList.append(action("COLOR_CMD"));
+  aList.append(action("DEFLECTION_CMD"));
+  aList.append(action("TRANSPARENCY_CMD"));
+  aList.append(action("SHOW_ISOLINES_CMD"));
+  aList.append(action("ISOLINES_CMD"));
+  aList.append(mySeparator3);
+  aList.append(action("SET_VIEW_NORMAL_CMD"));
+  aList.append(action("SET_VIEW_INVERTEDNORMAL_CMD"));
+  aList.append(mySeparator4);
+  aList.append(action("SHOW_ONLY_CMD"));
+  aList.append(action("HIDE_CMD"));
   myViewerMenu[ModelAPI_ResultGroup::group()] = aList;
-  myViewerMenu[ModelAPI_ResultField::group()] = aList;
+
   //-------------------------------------
   // Step objects menu
   aList.clear();
@@ -863,15 +909,17 @@ void XGUI_ContextMenuMgr::addObjBrowserMenu(QMenu* theMenu) const
       anActions.append(action("SHADING_CMD"));
       anActions.append(action("SHOW_EDGES_DIRECTION_CMD"));
       anActions.append(mySeparator1);
+      anActions.append(action("BRING_TO_FRONT_CMD"));
+      anActions.append(mySeparator2);
       anActions.append(action("SHOW_CMD"));
       anActions.append(action("HIDE_CMD"));
       anActions.append(action("SHOW_ONLY_CMD"));
-      anActions.append(mySeparator2);
+      anActions.append(mySeparator3);
       anActions.append(action("ADD_TO_FOLDER_BEFORE_CMD"));
       anActions.append(action("ADD_TO_FOLDER_AFTER_CMD"));
       anActions.append(action("ADD_OUT_FOLDER_BEFORE_CMD"));
       anActions.append(action("ADD_OUT_FOLDER_AFTER_CMD"));
-      anActions.append(mySeparator3);
+      anActions.append(mySeparator4);
       anActions.append(action("MOVE_CMD"));
       anActions.append(action("MOVE_SPLIT_CMD"));
       anActions.append(action("COLOR_CMD"));
index 686f44ccca48aae5d70e56aa845dbabdff00f546..cb448b12d38084c99619a5b01af5a97815b6bc83 100644 (file)
@@ -144,6 +144,7 @@ signals:
   QAction* mySeparator1;
   QAction* mySeparator2;
   QAction* mySeparator3;
+  QAction* mySeparator4;
 };
 
 #endif
index 8fda4fb34480ead10ae437d8eff6481bf4974222..2a7b07c1d0b7923a925a68449cb331b88c4fe18b 100644 (file)
@@ -36,6 +36,7 @@
 #include <ModelAPI_Tools.h>
 #include <ModelAPI_AttributeIntArray.h>
 #include <ModelAPI_ResultBody.h>
+#include <ModelAPI_ResultGroup.h>
 
 #include <ModuleBase_BRepOwner.h>
 #include <ModuleBase_IModule.h>
 /// defines the local context mouse selection sensitivity
 const int MOUSE_SENSITIVITY_IN_PIXEL = 10;
 
+/// defines the display priority for results brought to front
+constexpr int FRONT_DISPLAY_PRIORITY = 8; /* = Graphic3d_DisplayPriority_Highlight-1 */
+
+/// defines the default (normal) display priority for all results
+constexpr int DEFAULT_DISPLAY_PRIORITY = 5; /* = Graphic3d_DisplayPriority_Normal */
+
 //#define DEBUG_DISPLAY
 //#define DEBUG_FEATURE_REDISPLAY
 //#define DEBUG_SELECTION_FILTERS
@@ -215,6 +222,13 @@ bool XGUI_Displayer::display(ObjectPtr theObject, AISObjectPtr theAIS,
     int aDispMode = isShading? Shading : Wireframe;
     anAISIO->SetDisplayMode(aDispMode);
     aContext->Display(anAISIO, aDispMode, 0, false, AIS_DS_Displayed);
+    ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(theObject);
+    if (ModelAPI_Tools::isBringToFront(aResult)) {
+      // NOTE: do not use a priority higher than 8 as highlight uses priority 9!
+      //       Any higher level prevents the highlight from being visible as it would
+      //       appear "behind" the Groups.
+      aContext->SetDisplayPriority(anAISIO, FRONT_DISPLAY_PRIORITY);
+    }
     #ifdef TINSPECTOR
     if (getCallBack()) getCallBack()->Display(anAISIO);
     #endif
@@ -329,6 +343,13 @@ bool XGUI_Displayer::redisplay(ObjectPtr theObject, bool theUpdateViewer)
       Handle(ModuleBase_ResultPrs) aResPrs = Handle(ModuleBase_ResultPrs)::DownCast(aAISIO);
       if (!aResPrs.IsNull())
         aResPrs->updateIsoLines();
+
+      // Only support the "Bring To Front" command for Groups (for now)
+      ResultGroupPtr aGroup = std::dynamic_pointer_cast<ModelAPI_ResultGroup>(aResult);
+      if (aGroup.get()) {
+        bool isInFront = ModelAPI_Tools::isBringToFront(aResult);
+        aContext->SetDisplayPriority(aAISIO, (isInFront ? FRONT_DISPLAY_PRIORITY : DEFAULT_DISPLAY_PRIORITY));
+      }
     }
     //myWorkshop->module()->storeSelection();
 
index 124ac7bc109ce985c6e7ca3d7b81767053ce3e05..4d6efbfc9de0e86626cf685dfb222a37d34a4ebf 100644 (file)
@@ -1827,6 +1827,8 @@ void XGUI_Workshop::onContextMenuCommand(const QString& theId, bool isChecked)
     setDisplayMode(anObjects, XGUI_Displayer::Wireframe);
   else if (theId == "SHOW_EDGES_DIRECTION_CMD")
     toggleEdgesDirection(anObjects);
+  else if (theId == "BRING_TO_FRONT_CMD")
+    toggleBringToFront(anObjects);
   else if (theId == "HIDEALL_CMD") {
     QObjectPtrList aList = myDisplayer->displayedObjects();
     foreach (ObjectPtr aObj, aList) {
@@ -2034,8 +2036,9 @@ void XGUI_Workshop::deleteObjects()
   bool hasCompositeOwner = false;
   bool hasResultInHistory = false;
   bool hasFolder = false;
+  bool hasGroupsOnly = false;
   ModuleBase_Tools::checkObjects(anObjects, hasResult, hasFeature, hasParameter, hasCompositeOwner,
-                                 hasResultInHistory, hasFolder);
+                                 hasResultInHistory, hasFolder, hasGroupsOnly);
   if (!(hasResult || hasFeature || hasParameter || hasFolder))
     return;
 
@@ -3086,6 +3089,23 @@ void XGUI_Workshop::toggleEdgesDirection(const QObjectPtrList& theList)
     myDisplayer->updateViewer();
 }
 
+//**************************************************************
+void XGUI_Workshop::toggleBringToFront(const QObjectPtrList& theList)
+{
+  // Toggle the "BringToFront" state of all objects in the list
+  foreach(ObjectPtr anObj, theList) {
+    ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(anObj);
+    if (aResult.get() != NULL)
+    {
+      bool aBringToFront = !ModelAPI_Tools::isBringToFront(aResult);
+      ModelAPI_Tools::bringToFront(aResult, aBringToFront);
+      myDisplayer->redisplay(anObj, false);
+    }
+  }
+  if (theList.size() > 0)
+    myDisplayer->updateViewer();
+}
+
 //**************************************************************
 void XGUI_Workshop::closeDocument()
 {
index 81145343e00f38aff875f4adcb2d746c97334a02..aa12b955a32d98a6e5b8ff7ecb0f71f1b4f24a10 100644 (file)
@@ -239,6 +239,9 @@ Q_OBJECT
   /// Toggle visualisation of edges direction
   void toggleEdgesDirection(const QObjectPtrList& theList);
 
+  /// Toggle state of display priority (normal/in front)
+  void toggleBringToFront(const QObjectPtrList& theList);
+
   /// Set selection mode in viewer. If theMode=-1 then activate default mode
   /// \param theMode the selection mode (according to TopAbs_ShapeEnum)
   void setViewerSelectionMode(int theMode);
index 16f7ea842a982ab90ad26c53d91ed53d93461acf..9d89050d2aa3121ffd3d50b36e79987094369d23 100644 (file)
         <source>Show edges direction</source>
         <translation>Afficher la direction des bords</translation>
     </message>
+    <message>
+        <source>Bring To Front</source>
+        <translation>Afficher au premier plan</translation>
+    </message>
 </context>
 <context>
     <name>XGUI_DataTree</name>