SHAPER  9.15.0
XGUI_FacesPanel.h
1 // Copyright (C) 2014-2025 CEA, EDF
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 
20 #ifndef XGUI_FacesPanel_H_
21 #define XGUI_FacesPanel_H_
22 
23 #include "XGUI.h"
24 
25 #include <ModuleBase_ActionType.h>
26 #include <ModuleBase_Definitions.h>
27 #include <ModuleBase_ViewerPrs.h>
28 #include <ModuleBase_ResultPrs.h>
29 
30 #include <ModelAPI_Object.h>
31 #include <ModelAPI_Feature.h>
32 
33 #include <GeomAPI_AISObject.h>
34 
35 #include <SelectMgr_ListOfFilter.hxx>
36 #include <TopoDS_Shape.hxx>
37 
38 #include <QDockWidget>
39 #include <QObject>
40 #include <QMap>
41 
42 #include <set>
43 
45 
46 class GeomAPI_AISObject;
47 
48 class XGUI_Workshop;
50 
51 class QAction;
52 class QCheckBox;
53 class QEvent;
54 
71 class XGUI_EXPORT XGUI_FacesPanel : public QDockWidget
72 {
73  Q_OBJECT
74 public:
77  XGUI_FacesPanel(QWidget* theParent, XGUI_Workshop* theWorkshop);
78  ~XGUI_FacesPanel() {}
79 
82  virtual void reset(const bool isToFlushRedisplay);
83 
86  bool isEmpty() const;
87 
89  // \param theModes [out] a container of modes
90  void selectionModes(QIntList& theModes);
91 
94  void selectionFilters(SelectMgr_ListOfFilter& theSelectionFilters);
95 
97  bool isActivePanel() const { return myIsActive; }
98 
101  void setActivePanel(const bool theIsActive);
102 
106  bool isObjectHiddenByPanel(const ObjectPtr& theObject) const
107  { return myHiddenObjects.find(theObject) != myHiddenObjects.end(); }
108 
111  void restoreObjects(const std::set<ObjectPtr >& theHiddenObjects);
112 
114  virtual bool processAction(ModuleBase_ActionType theActionType);
115 
117  void processSelection();
118 
121  bool processDelete();
122 
124  void processUndo();
125 
129  virtual bool eventFilter(QObject* theObject, QEvent *theEvent);
130 
131  XGUI_Workshop* workshop() const { return myWorkshop; }
132 
133 public slots:
135  void onObjectDisplay(ObjectPtr theObject, AISObjectPtr theAIS);
136 
137 protected:
139  virtual void closeEvent(QCloseEvent* theEvent);
140 
141 signals:
143  void activated();
145  void deactivated();
147  void closed();
148 
149 private:
153  static bool redisplayObjects(const std::set<ObjectPtr>& theObjects);
154 
158  static void updateProcessedObjects(QMap<int, ModuleBase_ViewerPrsPtr> theItems,
159  std::set<ObjectPtr>& theObjects);
160 
163  bool useTransparency() const;
164 
165  double transparency() const;
166 
167  void removeItems(std::set<int> theIds);
168 
169 protected slots:
171  void onDeleteItem();
172 
174  void onTransparencyChanged();
175 
177  void onClosed();
178 
181  void flushRedisplay() const;
182 
183 private:
184 
185  QCheckBox* myHiddenOrTransparent;
186  ModuleBase_ListView* myListView;
187  XGUI_Workshop* myWorkshop;
188 
189  bool myIsActive;
190  int myLastItemIndex;
191  std::vector<int> myUndoList;
192 
193  QMap<int, ModuleBase_ViewerPrsPtr> myItems;
194  std::set<ObjectPtr > myItemObjects;
195  std::set<ObjectPtr > myHiddenObjects;
196 };
197 
198 #endif
Interface for AIS_InteractiveObject.
Definition: GeomAPI_AISObject.h:39
An extension of QListWidget to provide Undo/Redo functionality.
Definition: ModuleBase_ListView.h:94
A Hide Faces panel for making it possible to hide faces in the 3D view.
Definition: XGUI_FacesPanel.h:72
bool isObjectHiddenByPanel(const ObjectPtr &theObject) const
Returns true if the object is in internal container of hidden objects by this panel.
Definition: XGUI_FacesPanel.h:106
void deactivated()
Signal about deactivating pane.
void activated()
Signal about activating pane.
void closed()
Signal is emitted by the top widget cross button click.
bool isActivePanel() const
Returns whether the panel is active or not.
Definition: XGUI_FacesPanel.h:97
Class which defines a configuration of the application (Workshop) and launches it.
Definition: XGUI_Workshop.h:83