Salome HOME
Draft version of "Find River Bottom", new viewer dialog base class, new component...
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_CalculationDlg.h
1 // Copyright (C) 2007-2015  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
24 #ifndef HYDROGUI_CALCULATIONDLG_H
25 #define HYDROGUI_CALCULATIONDLG_H
26
27 #include "HYDROGUI_Wizard.h"
28 #include <HYDROData_CalculationCase.h>
29
30 class HYDROGUI_ObjSelector;
31 class HYDROGUI_DataBrowser;
32 class HYDROGUI_NameValidator;
33 class HYDROGUI_Zone;
34 class HYDROGUI_OrderedListWidget;
35 class HYDROGUI_PriorityWidget;
36
37 class SUIT_DataObject;
38
39 class QButtonGroup;
40 class QGroupBox;
41 class QLineEdit;
42 class QListWidget;
43 class QComboBox;
44 class QLabel;
45 class QSplitter;
46 class QStringList;
47
48
49 class HYDROGUI_CalculationDlg : public HYDROGUI_Wizard
50 {
51   Q_OBJECT
52
53 public:
54   HYDROGUI_CalculationDlg( HYDROGUI_Module* theModule, const QString& theTitle );
55   virtual ~HYDROGUI_CalculationDlg();
56
57   void                       reset();
58
59   int                        getMode() const;
60
61   void                       setObjectName( const QString& theName );
62   QString                    getObjectName() const;
63
64   void                       setEditedObject( const Handle(HYDROData_CalculationCase) theCase );
65
66   void                       setAllGeomObjects( const QStringList& theObjects, const QStringList& theObjectsEntries );
67   QStringList                getAllGeomObjects() const;
68   void                       setPolylineNames( const QStringList& theObjects, const QStringList& theObjectsEntries );
69   QStringList                getSelectedGeomObjects() const;
70   QStringList                getSelectedAvailableGeomObjects() const;
71   QStringList                getSelectedGroups() const;
72   QStringList                getSelectedAvailableGroups() const;
73   HYDROGUI_Zone*             getCurrentZone() const;
74   
75   void                       setAvailableGroups( const QStringList& );
76
77   void                       setEditZonesEnabled( const bool theIsEnabled );
78
79   HYDROData_ListOfRules      getRules() const;
80   void                       setRules( const HYDROData_ListOfRules& theRules ) const;
81
82 public slots:
83   void                       setMode( int theMode );
84   void                       setBoundary( const QString& theObjName );
85   void                       includeGeomObjects( const QStringList& theObjects );
86   void                       excludeGeomObjects( const QStringList& theObjects );
87   void                       includeGroups( const QStringList& theObjects );
88   void                       excludeGroups( const QStringList& theObjects );
89   void                       onEmptyName();
90   void                       onAlreadyExists( QString theName );
91   void                       refreshZonesBrowser();
92   void                       onDataChanged();
93   void                       onOrderChanged();
94
95   /**
96    * Process items selection: hide/show bathymetry merge type selector.
97    */
98   void                       onSelected( SUIT_DataObject* theObject );
99   /**
100    * Process merge type selection: set the selected bathymetry merge type for the currently selected zone.
101    */
102   void                       onMergeTypeSelected( int theIndex );
103   /**
104    * Process zones moving. Create a new region with dropped zones or add to existing one.
105    */
106   void                       onZonesDropped( const QList<SUIT_DataObject*>& theList, 
107     SUIT_DataObject* theTargetParent, int theTargetRow, Qt::DropAction theDropAction );
108
109 signals:
110   void                       changeMode( int theMode );
111
112   void                       addObjects();
113   void                       removeObjects();
114   void                       objectsSelected();
115
116   void                       addGroups();
117   void                       removeGroups();
118   void                       groupsSelected();
119
120   void                       boundarySelected( const QString & theObjName );
121   void                       setMergeType( int theMergeType, QString& theBathymetryName );
122   void                       createRegion( const QList<SUIT_DataObject*>& theZonesList );
123   void                       moveZones( SUIT_DataObject* theRegion, const QList<SUIT_DataObject*>& theZonesList );
124   void                       clickedInZonesBrowser( SUIT_DataObject* );
125
126 protected:
127
128   virtual bool               acceptCurrent() const;
129
130 private:
131   QList<Handle(HYDROData_Object)> getGeometryObjects();
132
133   QWizardPage*               createObjectsPage();
134   QWizardPage*               createGroupsPage();
135   QWizardPage*               createZonesPage();
136
137   QSplitter*                 mySplitter;
138
139   QGroupBox*                 myObjectNameGroup;
140   QLineEdit*                 myObjectName;
141   HYDROGUI_NameValidator*    myValidator;
142
143   QComboBox*                 myPolylineName;
144
145   QButtonGroup*              myModeButtons;
146
147   QListWidget*               myAvailableGeomObjects;
148   HYDROGUI_OrderedListWidget* myGeomObjects;
149
150   HYDROGUI_PriorityWidget*   myPriorityWidget;
151
152   QListWidget*               myAvailableGroups;
153   QListWidget*               myGroups;
154
155   HYDROGUI_DataBrowser*      myBrowser;
156   Handle(HYDROData_CalculationCase) myEditedObject;
157   QComboBox*                 myBathymetryChoice;
158   QLabel*                    myBathymetryLabel;
159   HYDROGUI_Zone*             myCurrentZone;
160 };
161
162 #endif
163