1 // Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
24 #ifndef HYDROGUI_CALCULATIONOP_H
25 #define HYDROGUI_CALCULATIONOP_H
27 #include "HYDROGUI_Operation.h"
29 #include "HYDROData_SplitToZonesTool.h"
30 #include "HYDROGUI_Shape.h"
32 #include <HYDROData_CalculationCase.h>
33 #include <HYDROData_Region.h>
35 class SUIT_ViewManager;
36 class OCCViewer_ViewManager;
37 class HYDROGUI_CalculationDlg;
38 class SUIT_DataObject;
40 class HYDROGUI_CalculationOp : public HYDROGUI_Operation
45 HYDROGUI_CalculationOp( HYDROGUI_Module* theModule, bool theIsEdit );
46 virtual ~HYDROGUI_CalculationOp();
49 virtual void startOperation();
50 virtual void abortOperation();
51 virtual void commitOperation();
53 virtual HYDROGUI_InputPanel* createInputPanel() const;
55 virtual void onApply();
56 virtual bool processApply( int& theUpdateFlags, QString& theErrorMsg,
57 QStringList& theBrowseObjectsEntries );
59 void setAvailableGroups();
64 * Change the creation mode.
65 * @param theMode the mode to set
67 void onChangeMode( int theMode );
70 * Add geometry objects selected in the module browser to the calculation case.
74 * Remove selected objects from the calculation case.
76 void onRemoveObjects();
79 * Add geometry groups selected in the module browser to the calculation case.
83 * Remove selected groups from the calculation case.
85 void onRemoveGroups();
88 * Set the given bathymetry merge type to the current zone.
90 void onSetMergeType( int theMergeType, QString& theBathymetryName );
92 * Selected zones are moved to the existing region.
94 void onMoveZones( SUIT_DataObject* theRegionItem,
95 const QList<SUIT_DataObject*>& theZonesList );
97 * Selected zones are moved to the new region to be created.
99 void onCreateRegion( const QList<SUIT_DataObject*>& theZonesList );
101 * Case objects must be splitted to zones if the case has been modified or new.
103 void onNext( const int );
104 void onLastViewClosed( SUIT_ViewManager* );
106 * The zone is selected in the browser on the second page of the wizard.
108 void onClickedInZonesBrowser( SUIT_DataObject* theItem );
110 * Hide zones in the viewer.
114 * Geometry object is selected in the list on the first wizard page
116 void onObjectsSelected();
118 * Boundary polyline is selected in the list on the first wizard page
120 void onBoundarySelected ( const QString & theObjName );
123 void createPreview();
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;
131 * Internal method that used to assign unique default colors for zones
133 void AssignDefaultZonesColors();
135 * Internal method that used to generate default color for zone
136 * @param theIndex the index of color to be generated
137 * @param theSaturation the saturation of the color in the range 0 to 1,
138 * and the bigger it is, the stronger the color is. Grayish colors have
139 * saturation near 0, very strong colors have saturation near 1.
140 * The defalt value is 0.5.
141 * @param theValue the value in the range 0 to 1, represents lightness or
142 * brightness of the color. 0 is black, 1 is as far from black as possible.
143 * The defalt value is 0.95.
144 * \return the generated color
146 QColor GenerateDefaultZonesColor( int theIndex,
147 float theSaturation = 0.5,
148 float theValue = 0.95 ) const;
151 * Ask user to confirm splitting zones recalculation after regions list modification.
152 * \return true if confirmed
154 bool confirmRegionsChange() const;
157 * Ask user to confirm splitting zones recalculation after mode change.
158 * \return true if confirmed
160 bool confirmModeChange() const;
163 * Ask user to confirm the operation continuation with warning.
164 * @param theWarning the warning
165 * \return true if confirmed
167 bool confirmContinueWithWarning( const HYDROData_Warning& theWarning ) const;
172 Handle(HYDROData_CalculationCase) myEditedObject;
174 SUIT_ViewManager* myActiveViewManager;
175 OCCViewer_ViewManager* myPreviewViewManager;