]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/XGUI/XGUI_FacesPanel.h
Salome HOME
Issue #2309 Possibility to hide faces : display hidden objects by panel if it uses...
[modules/shaper.git] / src / XGUI / XGUI_FacesPanel.h
index dd99a65dcc51ae06f918f6619f725eb092081f6d..8b5d71a6b4b24f2367b448bcb548e6e6b33ba755 100644 (file)
 
 #include "XGUI.h"
 
+#include <ModelAPI_Object.h>
+
 #include <ModuleBase_ActionType.h>
+#include <ModuleBase_ViewerPrs.h>
 
 #include <QDockWidget>
 #include <QObject>
 
 class AIS_InteractiveObject;
 
-class ModelAPI_Object;
+class GeomAPI_AISObject;
+
 class ModuleBase_IWorkshop;
 class ModuleBase_ListView;
-class ModuleBase_ViewerPrs;
 
 class QAction;
 class QCheckBox;
@@ -78,6 +81,10 @@ public:
   /// \param theIsActive state whether the panel should be activated or deactivated
   void setActivePanel(const bool theIsActive);
 
+  /// Returns true if transparency choice is checked
+  /// \return boolean value
+  bool useTransparency() const;
+
   /// Returns true if the object is in internal container of hidden objects by this panel
   /// \param theObject a checked object
   /// \return boolean value
@@ -109,9 +116,10 @@ public:
   /// If the object is displayed, all panel faces selected on it will be moved into presentation
   /// or, if redisplayed, fuction return if the object should be redisplayed or not
   /// \param theObject a customized object
-  /// \param isDisplayed state if the object is displayed or redisplayed
+  /// \param thePresentation visualized presentation of the object
   /// \return true if the presentation is customized
-  bool customizeObject(const std::shared_ptr<ModelAPI_Object>& theObject, const bool isDisplayed);
+  bool customizeObject(const std::shared_ptr<ModelAPI_Object>& theObject,
+    const std::shared_ptr<GeomAPI_AISObject>& thePresentation);
 
 protected:
   /// Add panel selection filters to the current viewer
@@ -136,17 +144,29 @@ private:
   /// Activate or deactivate selection and selection filters
   void activateSelection(bool toActivate);
 
-  /// Redisplay or display objects. The viewer is not updated after redisplay.
+  /// Redisplay objects.
   /// \param theObjects container of objects
   /// \param isToFlushRedisplay flag if redisplay should be flushed immediatelly
-  /// \return true if some of objects was redisplayed to update viewer
+  /// \return true if some of objects was redisplayed
   bool redisplayObjects(const std::set<std::shared_ptr<ModelAPI_Object> >& theObjects,
                         const bool isToFlushRedisplay);
 
-  /// Change the presentation to have the selected presentation hidden
-  /// \param theIndex an index of selected item that should be hidden
-  /// \return true if presentation is changed
-  bool hideFace(const int theIndex);
+  /// Display objects if the objects are in a container of hidden by this pane.
+  /// \param theObjects container of objects
+  /// \param isToFlushRedisplay flag if redisplay should be flushed immediatelly
+  /// \return true if some of objects was redisplayed
+  bool displayHiddenObjects(const std::set<std::shared_ptr<ModelAPI_Object> >& theObjects,
+                            const bool isToFlushRedisplay);
+
+  /// Iterates by items and hide objects where all sub-shapes are hidden
+  /// \return true if some of objects was redisplayed
+  bool hideEmptyObjects();
+
+  /// Container of objects participating in the panel, it is filled by internal container
+  /// \param theItems container of selected values
+  /// \param theObjects [out] container of objects
+  static void updateProcessedObjects(QMap<int, std::shared_ptr<ModuleBase_ViewerPrs> > theItems,
+                                     std::set<std::shared_ptr<ModelAPI_Object> >& theObjects);
 
   /// Generates a presentation name in form: <object_name>/<face>_<face_index>
   /// \param thePrs a presentation
@@ -157,6 +177,9 @@ protected slots:
   /// Deletes element in list of items
   void onDeleteItem();
 
+  /// Upates hidden faces to be hidden or transparent
+  void onTransparencyChanged();
+
   /// Closes faces panel restore all hidden faces by calling reset()
   void onClosed();
 
@@ -169,6 +192,7 @@ protected:
   int myLastItemIndex; ///< last index to be used in the map of items for the next added item
 
   QMap<int, std::shared_ptr<ModuleBase_ViewerPrs> > myItems; ///< selected face items
+  std::set<std::shared_ptr<ModelAPI_Object> > myItemObjects; ///< cached objects of myItems
   std::set<std::shared_ptr<ModelAPI_Object> > myHiddenObjects; ///< hidden objects
 };