Salome HOME
lot 10 - warnings for DTM - untested
[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_LandCoverMap.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, bool IsComplete );
52   virtual ~HYDROGUI_CalculationDlg();
53
54   void                       reset();
55
56   int                        getMode() const;
57   
58   void                       setObjectName( const QString& theName );
59   QString                    getObjectName() const;
60
61   void                       setEditedObject( const Handle(HYDROData_CalculationCase) theCase );
62
63   void                       setAllGeomObjects( const QStringList& theObjects, const QStringList& theObjectsEntries );
64   QStringList                getAllGeomObjects() const;
65   void                       setPolylineNames( const QStringList& theObjects, const QStringList& theObjectsEntries );
66   void                       setLandCoverMapsNames( 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   QStringList                getSelectedBoundaryPolygons() const;
73   QStringList                getSelectedISBoundaryPolygons() const;
74   QStringList                getSelectedAvailableBoundaryPolygons() const;
75   HYDROGUI_Zone*             getCurrentZone() const;
76   
77   void                       setAvailableGroups( const QStringList& );
78
79   void                       setAvailableBoundaryPolygons( const QStringList&, const QVector<int>& );
80
81   void                       setEditZonesEnabled( const bool theIsEnabled );
82
83   HYDROData_ListOfRules      getRules() const;
84   void                       setRules( const HYDROData_ListOfRules& theRules ) const;
85
86   QList<Handle(HYDROData_Entity)> getGeometryObjects(bool GeomObjOnly = true);
87
88 public slots:
89   void                       setMode( int theMode );
90   void                       setGeomOrderingEnabled( int enabled );
91
92   void                       setBoundary( const QString& theObjName );
93   void                       includeGeomObjects( const QStringList& theObjects );
94   void                       excludeGeomObjects( const QStringList& theObjects );
95   void                       includeGroups( const QStringList& theObjects );
96   void                       excludeGroups( const QStringList& theObjects );
97
98   void                       hideAvailableGeomObjects( const QStringList& theObjects );
99   void                       setAlreadyAddedGeomObjects( const QStringList& theObjects ); 
100   QStringList                getAlreadyAddedGeomObjects();
101
102
103   void                       includeBoundaryPolygons( const QStringList& theObjects );
104   void                       includeISBoundaryPolygons( const QStringList& theObjects );
105
106   void                       excludeBoundaryPolygons( const QStringList& theObjects );
107   void                       excludeISBoundaryPolygons( const QStringList& theObjects );
108
109
110   void                       onEmptyName();
111   void                       onAlreadyExists( QString theName );
112   void                       refreshZonesBrowser();
113   void                       onDataChanged();
114   void                       onOrderChanged();
115   void                       onRuleChanged();
116
117   void                       setStricklerTable( const QString& theStricklerTableName, bool theBlockSignals = true );
118   void                       setLandCoverMap( const QString& theLandCoverMapName, bool theBlockSignals = true );
119   
120   /**
121    * Process items selection: hide/show bathymetry merge type selector.
122    */
123   void                       onSelected( SUIT_DataObject* theObject );
124   /**
125    * Process merge type selection: set the selected bathymetry merge type for the currently selected zone.
126    */
127   void                       onMergeTypeSelected( int theIndex );
128   /**
129    * Process zones moving. Create a new region with dropped zones or add to existing one.
130    */
131   void                       onZonesDropped( const QList<SUIT_DataObject*>& theList, 
132     SUIT_DataObject* theTargetParent, int theTargetRow, Qt::DropAction theDropAction );
133
134 signals:
135   void                       changeMode( int theMode );  
136
137   void                       addObjects();
138   void                       removeObjects();
139   void                       objectsSelected();
140   void                       orderChanged( bool& isConfirmed );
141   void                       ruleChanged( bool& isConfirmed );
142
143   void                       addGroups();
144   void                       removeGroups();
145   void                       groupsSelected();
146
147   void                       addBoundaryPolygons();
148   void                       removeBoundaryPolygons();
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 );
154   void                       clickedInZonesBrowser( SUIT_DataObject* );
155
156   void                       landCoverMapSelected( const QString & theObjName );
157
158   void                       StricklerTableSelected( const QString & theObjName );
159
160   void                       regenerateColors();
161
162 protected:
163
164   virtual bool               acceptCurrent() const;
165
166 protected slots:
167   void OnNewRegion();
168
169 private:
170
171   
172   QWizardPage*               createObjectsPage();
173   QWizardPage*               createGroupsPage();
174   QWizardPage*               createBoundaryPolygonsPage();
175
176   QWizardPage*               createLandCoverMapPage();
177   QWizardPage*               createZonesPage();
178   
179   QSplitter*                 mySplitter;
180   
181   QGroupBox*                 myObjectNameGroup;
182   QLineEdit*                 myObjectName;
183   HYDROGUI_NameValidator*    myValidator;
184
185   QComboBox*                 myPolylineName;
186   QComboBox*                 myLandCoverMapName;
187   QComboBox*                 myStricklerTableName;
188
189   QButtonGroup*              myModeButtons;
190
191   QListWidget*               myAvailableGeomObjects;
192   HYDROGUI_OrderedListWidget* myGeomObjects;
193
194   QListWidget*               myAlreadyAddedGeomObjects;
195
196
197   HYDROGUI_PriorityWidget*   myPriorityWidget;
198
199   QListWidget*               myAvailableGroups;
200   QListWidget*               myGroups;
201
202   QListWidget*               myAvailableBoundaryPolygons;
203   QListWidget*               myBoundaryPolygons;
204   QListWidget*               myISBoundaryPolygons;
205
206
207   HYDROGUI_DataBrowser*      myBrowser;
208   Handle(HYDROData_CalculationCase) myEditedObject;
209   QComboBox*                 myBathymetryChoice;
210   QLabel*                    myBathymetryLabel;
211   HYDROGUI_Zone*             myCurrentZone;
212
213   bool                       myIsComplete;
214 };
215
216 #endif
217