Salome HOME
566ea281381e748c390641cfaef6d3402858989b
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_CalculationDlg.h
1 // Copyright (C) 2014-2015  EDF-R&D
2 // This library is free software; you can redistribute it and/or
3 // modify it under the terms of the GNU Lesser General Public
4 // License as published by the Free Software Foundation; either
5 // version 2.1 of the License, or (at your option) any later version.
6 //
7 // This library is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
10 // Lesser General Public License for more details.
11 //
12 // You should have received a copy of the GNU Lesser General Public
13 // License along with this library; if not, write to the Free Software
14 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
15 //
16 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
17 //
18
19
20 #ifndef HYDROGUI_CALCULATIONDLG_H
21 #define HYDROGUI_CALCULATIONDLG_H
22
23 #include "HYDROGUI_Wizard.h"
24 #include <HYDROData_CalculationCase.h>
25 #include <HYDROData_LandCover.h>
26
27 class HYDROGUI_ObjSelector;
28 class HYDROGUI_DataBrowser;
29 class HYDROGUI_NameValidator;
30 class HYDROGUI_Zone;
31 class HYDROGUI_OrderedListWidget;
32 class HYDROGUI_PriorityWidget;
33
34 class SUIT_DataObject;
35
36 class QButtonGroup;
37 class QGroupBox;
38 class QLineEdit;
39 class QListWidget;
40 class QComboBox;
41 class QLabel;
42 class QSplitter;
43 class QStringList;
44
45
46 class HYDROGUI_CalculationDlg : public HYDROGUI_Wizard
47 {
48   Q_OBJECT
49
50 public:
51   HYDROGUI_CalculationDlg( HYDROGUI_Module* theModule, const QString& theTitle );
52   virtual ~HYDROGUI_CalculationDlg();
53
54   void                       reset();
55
56   int                        getMode() const;
57   int                        getLandCoverMode() const;
58
59   void                       setObjectName( const QString& theName );
60   QString                    getObjectName() const;
61
62   void                       setEditedObject( const Handle(HYDROData_CalculationCase) theCase );
63
64   void                       setAllGeomObjects( const QStringList& theObjects, const QStringList& theObjectsEntries );
65   QStringList                getAllGeomObjects() const;
66   void                       setPolylineNames( const QStringList& theObjects, const QStringList& theObjectsEntries );
67   void                       setStricklerTableNames( const QStringList& theObjects, const QStringList& theObjectsEntries );
68   QStringList                getSelectedGeomObjects() const;
69   QStringList                getSelectedAvailableGeomObjects() const;
70   QStringList                getSelectedGroups() const;
71   QStringList                getSelectedAvailableGroups() const;
72   HYDROGUI_Zone*             getCurrentZone() const;
73   
74   void                       setAvailableGroups( const QStringList& );
75
76   void                       setEditZonesEnabled( const bool theIsEnabled );
77   void                       setEditLandCoversEnabled( 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   void                       setLandCoverMode( int theMode );
96   void                       setStricklerTable( const QString& theStricklerTableName );
97   void                       onOrderLandCoverChanged();
98
99   /**
100    * Process items selection: hide/show bathymetry merge type selector.
101    */
102   void                       onSelected( SUIT_DataObject* theObject );
103   /**
104    * Process merge type selection: set the selected bathymetry merge type for the currently selected zone.
105    */
106   void                       onMergeTypeSelected( int theIndex );
107   /**
108    * Process zones moving. Create a new region with dropped zones or add to existing one.
109    */
110   void                       onZonesDropped( const QList<SUIT_DataObject*>& theList, 
111     SUIT_DataObject* theTargetParent, int theTargetRow, Qt::DropAction theDropAction );
112
113 signals:
114   void                       changeMode( int theMode );  
115
116   void                       addObjects();
117   void                       removeObjects();
118   void                       objectsSelected();
119   void                       orderChanged( bool& isConfirmed );
120
121   void                       addGroups();
122   void                       removeGroups();
123   void                       groupsSelected();
124
125   void                       boundarySelected( const QString & theObjName );
126   void                       setMergeType( int theMergeType, QString& theBathymetryName );
127   void                       createRegion( const QList<SUIT_DataObject*>& theZonesList );
128   void                       moveZones( SUIT_DataObject* theRegion, const QList<SUIT_DataObject*>& theZonesList );
129   void                       clickedInZonesBrowser( SUIT_DataObject* );
130
131   void                       changeLandCoverMode( int theMode );
132
133   void                       addLandCovers();
134   void                       removeLandCovers();
135   void                       orderLandCoverChanged( bool& isConfirmed );
136   
137   void                       StricklerTableSelected( const QString & theObjName );
138
139 protected:
140
141   virtual bool               acceptCurrent() const;
142
143 protected slots:
144   void OnNewRegion();
145
146 private:
147   QList<Handle(HYDROData_Object)> getGeometryObjects();
148   QList<Handle(HYDROData_LandCover)> getLandCovers();
149
150   QWizardPage*               createObjectsPage();
151   QWizardPage*               createGroupsPage();
152   QWizardPage*               createLandCoversPage();
153   QWizardPage*               createZonesPage();
154   QWizardPage*               createLandCoversPartitionPage();
155
156   QSplitter*                 mySplitter;
157   QSplitter*                 myLandCoverSplitter;
158
159   QGroupBox*                 myObjectNameGroup;
160   QLineEdit*                 myObjectName;
161   HYDROGUI_NameValidator*    myValidator;
162
163   QComboBox*                 myPolylineName;
164   QComboBox*                 myStricklerTableName;
165
166   QButtonGroup*              myModeButtons;
167   QButtonGroup*              myLandCoverModeButtons;
168
169   QListWidget*               myAvailableGeomObjects;
170   HYDROGUI_OrderedListWidget* myGeomObjects;
171
172   HYDROGUI_PriorityWidget*   myPriorityWidget;
173   HYDROGUI_PriorityWidget*   myLandCoverPriorityWidget;
174
175   QListWidget*               myAvailableGroups;
176   QListWidget*               myGroups;
177
178   QListWidget*               myAvailableLandCovers;
179   HYDROGUI_OrderedListWidget* myLandCovers;
180
181   HYDROGUI_DataBrowser*      myBrowser;
182   Handle(HYDROData_CalculationCase) myEditedObject;
183   QComboBox*                 myBathymetryChoice;
184   QLabel*                    myBathymetryLabel;
185   HYDROGUI_Zone*             myCurrentZone;
186
187   HYDROGUI_DataBrowser*      myLandCoverBrowser;
188 };
189
190 #endif
191