Salome HOME
Merge branch 'BR_v14_rc' into BR_quadtree
[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                       setAllLandCovers( const QStringList& theObjects, const QStringList& theObjectsEntries );
67   QStringList                getAllLandCovers() const;
68   void                       setPolylineNames( const QStringList& theObjects, const QStringList& theObjectsEntries );
69   void                       setStricklerTableNames( const QStringList& theObjects, const QStringList& theObjectsEntries );
70   QStringList                getSelectedGeomObjects() const;
71   QStringList                getSelectedLandCovers() const;
72   QStringList                getSelectedAvailableGeomObjects() const;
73   QStringList                getSelectedAvailableLandCovers() const;
74   QStringList                getSelectedGroups() const;
75   QStringList                getSelectedAvailableGroups() const;
76   HYDROGUI_Zone*             getCurrentZone() const;
77   
78   void                       setAvailableGroups( const QStringList& );
79
80   void                       setEditZonesEnabled( const bool theIsEnabled );
81   void                       setEditLandCoverZonesEnabled( const bool theIsEnabled );
82
83   HYDROData_ListOfRules      getRules() const;
84   void                       setRules( const HYDROData_ListOfRules& theRules ) const;
85
86   HYDROData_ListOfRules      getLandCoverRules() const;
87   void                       setLandCoverRules( const HYDROData_ListOfRules& theRules ) const;
88
89 public slots:
90   void                       setMode( int theMode );
91   void                       setBoundary( const QString& theObjName );
92   void                       includeGeomObjects( const QStringList& theObjects );
93   void                       excludeGeomObjects( const QStringList& theObjects );
94   void                       includeGroups( const QStringList& theObjects );
95   void                       excludeGroups( const QStringList& theObjects );
96   void                       onEmptyName();
97   void                       onAlreadyExists( QString theName );
98   void                       refreshZonesBrowser();
99   void                       onDataChanged();
100   void                       onOrderChanged();
101
102   void                       setLandCoverMode( int theMode );
103   void                       setStricklerTable( const QString& theStricklerTableName, bool theBlockSignals = true );
104   void                       includeLandCovers( const QStringList& theLandCovers, bool theReset );
105   void                       excludeLandCovers( const QStringList& theLandCovers );
106   void                       refreshLandCoverZonesBrowser();
107   void                       onDataLandCoverChanged();
108   void                       onOrderLandCoverChanged();
109
110   /**
111    * Process items selection: hide/show bathymetry merge type selector.
112    */
113   void                       onSelected( SUIT_DataObject* theObject );
114   /**
115    * Process merge type selection: set the selected bathymetry merge type for the currently selected zone.
116    */
117   void                       onMergeTypeSelected( int theIndex );
118   /**
119    * Process zones moving. Create a new region with dropped zones or add to existing one.
120    */
121   void                       onZonesDropped( const QList<SUIT_DataObject*>& theList, 
122     SUIT_DataObject* theTargetParent, int theTargetRow, Qt::DropAction theDropAction );
123
124   /**
125    * Process items selection: hide/show Strickler type merge type selector.
126    */
127   void                       onLandCoverZoneSelected( SUIT_DataObject* theObject );
128   /**
129    * Process merge type selection: set the selected Strickler type merge type for the currently selected zone.
130    */
131   void                       onMergeStricklerTypeSelected( int theIndex );
132   /**
133    * Process land cover zones moving. Create a new region with dropped zones or add to existing one.
134    */
135   void                       onLandCoverZonesDropped( const QList<SUIT_DataObject*>& theList, 
136     SUIT_DataObject* theTargetParent, int theTargetRow, Qt::DropAction theDropAction );
137
138 signals:
139   void                       changeMode( int theMode );  
140
141   void                       addObjects();
142   void                       removeObjects();
143   void                       objectsSelected();
144   void                       orderChanged( bool& isConfirmed );
145
146   void                       addGroups();
147   void                       removeGroups();
148   void                       groupsSelected();
149
150   void                       boundarySelected( const QString & theObjName );
151   void                       setMergeType( int theMergeType, QString& theBathymetryName );
152   void                       createRegion( const QList<SUIT_DataObject*>& theZonesList );
153   void                       moveZones( SUIT_DataObject* theRegion, const QList<SUIT_DataObject*>& theZonesList, bool theLandCover );
154   void                       clickedInZonesBrowser( SUIT_DataObject* );
155
156   void                       changeLandCoverMode( int theMode );
157
158   void                       addLandCovers();
159   void                       removeLandCovers();
160   void                       landCoversSelected();
161   void                       orderLandCoverChanged( bool& isConfirmed );
162
163   void                       createLandCoverRegion( const QList<SUIT_DataObject*>& theLandCoverZonesList );
164   
165   void                       StricklerTableSelected( const QString & theObjName );
166   void                       setMergeStricklerType( int theMergeType, QString& theStricklerTypeName );
167
168 protected:
169
170   virtual bool               acceptCurrent() const;
171
172 protected slots:
173   void OnNewRegion();
174   void OnNewLandCoverRegion();
175
176 private:
177   QList<Handle(HYDROData_Entity)> getGeometryObjects();
178   QList<Handle(HYDROData_Entity)> getLandCovers();
179
180   QWizardPage*               createObjectsPage();
181   QWizardPage*               createGroupsPage();
182   QWizardPage*               createLandCoversPage();
183   QWizardPage*               createZonesPage();
184   QWizardPage*               createLandCoverZonesPage();
185
186   QSplitter*                 mySplitter;
187   QSplitter*                 myLandCoverSplitter;
188
189   QGroupBox*                 myObjectNameGroup;
190   QLineEdit*                 myObjectName;
191   HYDROGUI_NameValidator*    myValidator;
192
193   QComboBox*                 myPolylineName;
194   QComboBox*                 myStricklerTableName;
195
196   QButtonGroup*              myModeButtons;
197   QButtonGroup*              myLandCoverModeButtons;
198
199   QListWidget*               myAvailableGeomObjects;
200   HYDROGUI_OrderedListWidget* myGeomObjects;
201
202   HYDROGUI_PriorityWidget*   myPriorityWidget;
203   HYDROGUI_PriorityWidget*   myLandCoverPriorityWidget;
204
205   QListWidget*               myAvailableGroups;
206   QListWidget*               myGroups;
207
208   QListWidget*               myAvailableLandCovers;
209   HYDROGUI_OrderedListWidget* myLandCovers;
210
211   HYDROGUI_DataBrowser*      myBrowser;
212   Handle(HYDROData_CalculationCase) myEditedObject;
213   QComboBox*                 myBathymetryChoice;
214   QLabel*                    myBathymetryLabel;
215   HYDROGUI_Zone*             myCurrentZone;
216
217   HYDROGUI_DataBrowser*      myLandCoverBrowser;
218   QComboBox*                 myStricklerTypeChoice;
219   QLabel*                    myStricklerTypeLabel;
220 };
221
222 #endif
223