Salome HOME
7dc6b5af0968b43ebf41077dee974c2ffffcb059
[modules/geom.git] / src / OperationGUI / OperationGUI_ExtractionDlg.h
1 // Copyright (C) 2007-2023  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 #ifndef OPERATIONGUI_EXTRACTIONDLG_H
24 #define OPERATIONGUI_EXTRACTIONDLG_H
25
26 #include <GEOMBase_Skeleton.h>
27
28 #include <TopTools_IndexedMapOfShape.hxx>
29 #include <TColStd_MapOfInteger.hxx>
30
31 class QComboBox;
32 class QListWidget;
33 class QTreeWidget;
34 class QTreeWidgetItem;
35
36
37 //=================================================================================
38 // class    : OperationGUI_ExtractionDlg
39 // purpose  :
40 //=================================================================================
41 class OperationGUI_ExtractionDlg : public GEOMBase_Skeleton
42 {
43
44   Q_OBJECT
45
46 public:
47
48   OperationGUI_ExtractionDlg( GeometryGUI*, QWidget* );
49   ~OperationGUI_ExtractionDlg();
50
51 protected:
52
53   // redefined from GEOMBase_Helper and MeasureGUI_Skeleton
54   virtual GEOM::GEOM_IOperations_ptr  createOperation();
55   virtual bool                        execute(ObjectList &);
56   virtual void                        activateSelection();
57   virtual bool                        isValid( QString& );
58
59 private slots:
60
61   void                                SelectionIntoArgument();
62   void                                ClickOnOk();
63   bool                                ClickOnApply();
64   void                                onShapeTypeChanged();
65   void                                onAddExtracted();
66   void                                onRemoveExtracted();
67   void                                onListSelectionChanged();
68   void                                showOnlySelected();
69   void                                hideSelected();
70   void                                showAllSelected();
71   void                                onRebuild();
72   void                                ActivateThisDialog();
73   void                                SetEditCurrentArgument();
74
75 private:
76
77   void                                Init();
78   bool                                updateSubShTypeCompo();
79   void                                updateFilteredList();
80   void                                resetBuildData(const bool isEnableBuild);
81   bool                                isEmptyExtracted();
82   void                                selectMainShape();
83   void                                selectSubShapes();
84   void                                enterEvent(QEvent *);
85   bool                                getResult
86              (GEOM::GEOM_Object_ptr                         &theResult,
87               GEOM::GEOM_IShapesOperations::ExtractionStats &theStats);
88   QString                             getSubShapeEntry(const int theId);
89   Handle_SALOME_InteractiveObject     createIO(const char *theEntry);
90   void                                displaySubShape(const int theId);
91   void                                eraseSubShape(const int theId);
92   void                                eraseAll();
93   void                                restoreViewer();
94
95 private:
96
97   GEOM::GEOM_Object_var       myObj;
98   QPushButton                *mySelBtn;
99   QLineEdit                  *myMainShapeEdit;
100   QComboBox                  *mySubShTypeCompo;
101   QListWidget                *myFilteredList;
102   QTreeWidget                *myExtractedTree;
103   QListWidget                *myRemovedList;
104   QListWidget                *myModifiedList;
105   QListWidget                *myAddedList;
106   QTreeWidgetItem            *myTopItems[8];
107   QPushButton                *myRebuildBtn;
108   TColStd_MapOfInteger        myMapExtractedIDs;
109   bool                        myIsHiddenMain;
110   TColStd_MapOfInteger        myMapDisplayedIDs;
111   TopTools_IndexedMapOfShape  myIndices;
112
113 };
114
115 #endif // OPERATIONGUI_EXTRACTIONDLG_H