SHAPER  9.12.0
XGUI_FacesPanel.h
1 // Copyright (C) 2014-2023 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_ResultGroup.h>
32 #include <ModelAPI_Feature.h>
33 
34 #include <GeomAPI_AISObject.h>
35 
36 #include <SelectMgr_ListOfFilter.hxx>
37 #include <TopoDS_Shape.hxx>
38 
39 #include <QDockWidget>
40 #include <QObject>
41 #include <QMap>
42 
43 #include <set>
44 
46 
47 class GeomAPI_AISObject;
48 
49 class XGUI_Workshop;
51 
52 class QAction;
53 class QCheckBox;
54 class QEvent;
55 
72 class XGUI_EXPORT XGUI_FacesPanel : public QDockWidget
73 {
74  Q_OBJECT
75 public:
78  XGUI_FacesPanel(QWidget* theParent, XGUI_Workshop* theWorkshop);
79  ~XGUI_FacesPanel() {}
80 
83  virtual void reset(const bool isToFlushRedisplay);
84 
87  bool isEmpty() const;
88 
90  // \param theModes [out] a container of modes
91  void selectionModes(QIntList& theModes);
92 
95  void selectionFilters(SelectMgr_ListOfFilter& theSelectionFilters);
96 
98  bool isActivePanel() const { return myIsActive; }
99 
102  void setActivePanel(const bool theIsActive);
103 
107  bool isObjectHiddenByPanel(const ObjectPtr& theObject) const
108  { return myHiddenObjects.find(theObject) != myHiddenObjects.end(); }
109 
112  void restoreObjects(const std::set<ObjectPtr >& theHiddenObjects);
113 
115  virtual bool processAction(ModuleBase_ActionType theActionType);
116 
118  void processSelection();
119 
122  bool processDelete();
123 
125  void processUndo();
126 
130  virtual bool eventFilter(QObject* theObject, QEvent *theEvent);
131 
132  XGUI_Workshop* workshop() const { return myWorkshop; }
133 
134 public slots:
136  void onObjectDisplay(ObjectPtr theObject, AISObjectPtr theAIS);
137 
138 protected:
140  virtual void closeEvent(QCloseEvent* theEvent);
141 
142 signals:
144  void activated();
146  void deactivated();
148  void closed();
149 
150 private:
154  static bool redisplayObjects(const std::set<ObjectPtr>& theObjects);
155 
159  static void updateProcessedObjects(QMap<int, ModuleBase_ViewerPrsPtr> theItems,
160  std::set<ObjectPtr>& theObjects);
161 
168  void getObjectsMapFromResult(ResultGroupPtr theResGroup, FeaturePtr theGroupFeature,
169  std::map<ObjectPtr, TopoDS_ListOfShape>& theObjectsToShapes,
170  std::map<ObjectPtr, Handle(ModuleBase_ResultPrs) >& theObjectToPrs);
171 
172  void getObjectsMapFromPrs(ModuleBase_ViewerPrsPtr thePrs,
173  std::map<ObjectPtr, TopoDS_ListOfShape>& theObjectToShapes,
174  std::map<ObjectPtr, Handle(ModuleBase_ResultPrs) >& theObjectToPrs);
175 
178  bool useTransparency() const;
179 
180  double transparency() const;
181 
182  void removeItems(std::set<int> theIds);
183 
184 protected slots:
186  void onDeleteItem();
187 
189  void onTransparencyChanged();
190 
192  void onClosed();
193 
196  void flushRedisplay() const;
197 
198 private:
199 
200  QCheckBox* myHiddenOrTransparent;
201  ModuleBase_ListView* myListView;
202  XGUI_Workshop* myWorkshop;
203 
204  bool myIsActive;
205  int myLastItemIndex;
206  std::vector<int> myUndoList;
207 
208  QMap<int, ModuleBase_ViewerPrsPtr> myItems;
209  std::set<ObjectPtr > myItemObjects;
210  std::set<ObjectPtr > myHiddenObjects;
211  std::set<ObjectPtr > myHiddenGroups;
212 };
213 
214 #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 redefinition of standard AIS Interactive Object in order to provide specific behaviour for wire pre...
Definition: ModuleBase_ResultPrs.h:48
A Hide Faces panel for making it possible to hide faces in the 3D view.
Definition: XGUI_FacesPanel.h:73
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:107
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:98
Class which defines a configuration of the application (Workshop) and launches it.
Definition: XGUI_Workshop.h:82