Salome HOME
0022472: EDF 2690 GEOM: Keep only some terminal objects and its parents
[modules/geom.git] / src / GEOMToolsGUI / GEOMToolsGUI_ReduceStudyDlg.h
1 // Copyright (C) 2014  CEA/DEN, EDF R&D, OPEN CASCADE
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 GEOMTOOLSGUI_REDUCESTUDYDLG_H
21 #define GEOMTOOLSGUI_REDUCESTUDYDLG_H
22
23 #include "GEOM_ToolsGUI.hxx"
24 #include <QDialog>
25 #include <QTreeWidget>
26 #include <QCheckBox>
27
28 #include <GEOMUtils.hxx>
29 #include <GeometryGUI.h>
30 #include <GEOM_Displayer.h>
31
32 #include <set>
33
34 class GEOMToolsGUI_TreeWidgetItem : public QTreeWidgetItem
35 {
36 public:
37   GEOMToolsGUI_TreeWidgetItem( QTreeWidget*, const QStringList&, char*, bool, int = Type );
38   GEOMToolsGUI_TreeWidgetItem( QTreeWidgetItem*, const QStringList&, char*, bool, int = Type );
39   ~GEOMToolsGUI_TreeWidgetItem();
40
41   bool isVisible();
42   void setVisible( bool, QIcon& );
43
44   char* getStudyEntry() const;
45
46 private:
47   char* myStudyEntry;
48   bool myVisible;
49 };
50
51 class GEOMTOOLSGUI_EXPORT GEOMToolsGUI_ReduceStudyDlg : public QDialog
52
53   Q_OBJECT
54
55 public:
56   GEOMToolsGUI_ReduceStudyDlg( const GEOM::string_array&, QWidget* );
57   ~GEOMToolsGUI_ReduceStudyDlg();
58
59 private slots:
60
61   void onUnpublishIntermediate( bool );
62   void onRemoveIntermediate( bool );
63   void onKeepSubObjects( bool );
64   void onRemoveEmptyFolder( bool );
65   void onSoftRemoval( bool );
66
67   void clickOnOk();
68   void clickOnCancel();
69   void clickOnHelp();
70
71   void onSelectionChanged();
72   void onItemClicked(QTreeWidgetItem*, int );
73   void onHeaderClicked( int );
74
75   void update();
76
77 private:
78
79   void onShowOnlySelected();
80   void checkVisibleIcon( QTreeWidget* );
81   void sortObjects( QTreeWidget*, std::set<std::string>& );
82   GEOMToolsGUI_TreeWidgetItem* addSubObject( QTreeWidget*, std::set<std::string>&, GEOM::GEOM_Object_var );
83   GEOMToolsGUI_TreeWidgetItem* findObjectInTree( QTreeWidget*, GEOM::GEOM_Object_var );
84
85   QTreeWidget* myTreeKeptObjects;
86   QTreeWidget* myTreeRemoveObjects;
87
88   QCheckBox* myCBUnpublishIntermediate;
89   QCheckBox* myCBRemoveIntermediate;
90   QCheckBox* myCBKeepSubObjects;
91   QCheckBox* myCBRemoveEmptyFolder;
92   QCheckBox* myCBSoftRemoval;
93
94   std::set<std::string> myMainEntries;
95
96   QIcon myVisible;
97   QIcon myInvisible;
98
99   bool mySelectAll;
100
101   GEOM_Displayer myDisplayer;
102
103   std::set<std::string> myParents;
104   std::set<std::string> mySubObjects;
105   std::set<std::string> myOthers;
106
107   std::map<QTreeWidget*,bool> myMapTreeSelectAll;
108 };
109
110 #endif