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