Salome HOME
Draft version of "Find River Bottom", new viewer dialog base class, new component...
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_CalculationOp.h
1 // Copyright (C) 2007-2015  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23
24 #ifndef HYDROGUI_CALCULATIONOP_H
25 #define HYDROGUI_CALCULATIONOP_H
26
27 #include "HYDROGUI_Operation.h"
28
29 #include "HYDROData_SplitToZonesTool.h"
30 #include "HYDROGUI_Shape.h"
31
32 #include <HYDROData_CalculationCase.h>
33 #include <HYDROData_Region.h>
34
35 class SUIT_ViewManager;
36 class OCCViewer_ViewManager;
37 class HYDROGUI_CalculationDlg;
38 class SUIT_DataObject;
39
40 class HYDROGUI_CalculationOp : public HYDROGUI_Operation
41 {
42   Q_OBJECT
43
44 public:
45   HYDROGUI_CalculationOp( HYDROGUI_Module* theModule, bool theIsEdit );
46   virtual ~HYDROGUI_CalculationOp();
47
48 protected:
49   virtual void                    startOperation();
50   virtual void                    abortOperation();
51   virtual void                    commitOperation();
52
53   virtual HYDROGUI_InputPanel*    createInputPanel() const;
54
55   virtual void                    onApply();
56   virtual bool                    processApply( int& theUpdateFlags, QString& theErrorMsg,
57                                                 QStringList& theBrowseObjectsEntries );
58
59   void setAvailableGroups();
60
61 protected slots:
62
63   /**
64    * Change the creation mode.
65    * @param theMode the mode to set
66    */
67   void                            onChangeMode( int theMode );
68
69   /**
70    * Add geometry objects selected in the module browser to the calculation case.
71    */
72   void                            onAddObjects();
73   /**
74    * Remove selected objects from the calculation case.
75    */
76   void                            onRemoveObjects();
77
78   /**
79    * Add geometry groups selected in the module browser to the calculation case.
80    */
81   void                            onAddGroups();
82   /**
83    * Remove selected groups from the calculation case.
84    */
85   void                            onRemoveGroups();
86
87   /**
88    * Set the given bathymetry merge type to the current zone.
89    */
90   void                            onSetMergeType( int theMergeType, QString& theBathymetryName );
91   /**
92    * Selected zones are moved to the existing region.
93    */
94   void                            onMoveZones( SUIT_DataObject* theRegionItem, 
95                                                const QList<SUIT_DataObject*>& theZonesList );
96   /**
97    * Selected zones are moved to the new region to be created.
98    */
99   void                            onCreateRegion( const QList<SUIT_DataObject*>& theZonesList );
100   /**
101    * Case objects must be splitted to zones if the case has been modified or new.
102    */
103   void                            onNext( const int );
104   void                            onLastViewClosed( SUIT_ViewManager* );
105   /**
106    * The zone is selected in the browser on the second page of the wizard.
107    */
108   void                            onClickedInZonesBrowser( SUIT_DataObject* theItem );
109   /**
110    * Hide zones in the viewer.
111    */
112   void                            onHideZones();
113   /** 
114    * Geometry object is selected in the list on the first wizard page
115    */
116   void                            onObjectsSelected();
117   /** 
118    * Boundary polyline is selected in the list on the first wizard page
119    */
120   void                            onBoundarySelected ( const QString & theObjName );
121
122 private:
123   void                            createPreview();
124   void                            closePreview();
125   void                            setObjectVisibility( Handle(HYDROData_Entity) theEntity, const bool theIsVisible );
126   void                            setZonesVisible( bool theIsVisible );
127   void                            getNamesAndEntries( const HYDROData_SequenceOfObjects& theSeq, 
128                                                       QStringList& theNames, QStringList& theEntries ) const;
129
130   /**
131    * Ask user to confirm splitting zones recalculation after regions list modification.
132    * \return true if confirmed
133    */
134   bool                            confirmRegionsChange() const;
135
136   /**
137    * Ask user to confirm splitting zones recalculation after mode change.
138    * \return true if confirmed
139    */
140   bool                            confirmModeChange() const;
141
142   /**
143    * Ask user to confirm the operation continuation with warning.
144    * @param theWarning the warning
145    * \return true if confirmed
146    */
147   bool                            confirmContinueWithWarning( const HYDROData_Warning& theWarning ) const;
148
149 private:
150   bool                            myIsEdit;
151   bool                            myShowZones;
152   Handle(HYDROData_CalculationCase) myEditedObject;
153
154   SUIT_ViewManager*               myActiveViewManager;
155   OCCViewer_ViewManager*          myPreviewViewManager;
156 };
157
158 #endif
159
160