Salome HOME
Remove references to land cover object from data model and GUI in order to have a...
[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 );
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   // TODO: setLandCoverMapsNames(...)
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
78   HYDROData_ListOfRules      getRules() const;
79   void                       setRules( const HYDROData_ListOfRules& theRules ) const;
80
81 public slots:
82   void                       setMode( int theMode );
83   void                       setBoundary( const QString& theObjName );
84   void                       includeGeomObjects( const QStringList& theObjects );
85   void                       excludeGeomObjects( const QStringList& theObjects );
86   void                       includeGroups( const QStringList& theObjects );
87   void                       excludeGroups( const QStringList& theObjects );
88   void                       onEmptyName();
89   void                       onAlreadyExists( QString theName );
90   void                       refreshZonesBrowser();
91   void                       onDataChanged();
92   void                       onOrderChanged();
93   void                       onRuleChanged();
94
95   void                       setStricklerTable( const QString& theStricklerTableName, bool theBlockSignals = true );
96   
97   /**
98    * Process items selection: hide/show bathymetry merge type selector.
99    */
100   void                       onSelected( SUIT_DataObject* theObject );
101   /**
102    * Process merge type selection: set the selected bathymetry merge type for the currently selected zone.
103    */
104   void                       onMergeTypeSelected( int theIndex );
105   /**
106    * Process zones moving. Create a new region with dropped zones or add to existing one.
107    */
108   void                       onZonesDropped( const QList<SUIT_DataObject*>& theList, 
109     SUIT_DataObject* theTargetParent, int theTargetRow, Qt::DropAction theDropAction );
110
111 signals:
112   void                       changeMode( int theMode );  
113
114   void                       addObjects();
115   void                       removeObjects();
116   void                       objectsSelected();
117   void                       orderChanged( bool& isConfirmed );
118   void                       ruleChanged( bool& isConfirmed );
119
120   void                       addGroups();
121   void                       removeGroups();
122   void                       groupsSelected();
123
124   void                       boundarySelected( const QString & theObjName );
125   void                       setMergeType( int theMergeType, QString& theBathymetryName );
126   void                       createRegion( const QList<SUIT_DataObject*>& theZonesList );
127   void                       moveZones( SUIT_DataObject* theRegion, const QList<SUIT_DataObject*>& theZonesList );
128   void                       clickedInZonesBrowser( SUIT_DataObject* );
129
130   void                       landCoverMapSelected();
131
132   void                       StricklerTableSelected( const QString & theObjName );
133
134   void                       regenerateColors();
135
136 protected:
137
138   virtual bool               acceptCurrent() const;
139
140 protected slots:
141   void OnNewRegion();
142
143 private:
144   QList<Handle(HYDROData_Entity)> getGeometryObjects();
145   
146   Handle(HYDROData_LandCoverMap) getLandCoverMap();
147   
148   QWizardPage*               createObjectsPage();
149   QWizardPage*               createGroupsPage();
150   QWizardPage*               createLandCoverMapPage();
151   QWizardPage*               createZonesPage();
152   
153   QSplitter*                 mySplitter;
154   
155   QGroupBox*                 myObjectNameGroup;
156   QLineEdit*                 myObjectName;
157   HYDROGUI_NameValidator*    myValidator;
158
159   QComboBox*                 myPolylineName;
160   // TODO: myLandCoverMapName
161   QComboBox*                 myStricklerTableName;
162
163   QButtonGroup*              myModeButtons;
164
165   QListWidget*               myAvailableGeomObjects;
166   HYDROGUI_OrderedListWidget* myGeomObjects;
167
168   HYDROGUI_PriorityWidget*   myPriorityWidget;
169
170   QListWidget*               myAvailableGroups;
171   QListWidget*               myGroups;
172
173   HYDROGUI_DataBrowser*      myBrowser;
174   Handle(HYDROData_CalculationCase) myEditedObject;
175   QComboBox*                 myBathymetryChoice;
176   QLabel*                    myBathymetryLabel;
177   HYDROGUI_Zone*             myCurrentZone;
178 };
179
180 #endif
181