Salome HOME
f26b1ef4687f584ee140239d754d5a473fa14137
[modules/visu.git] / src / VISUGUI / VisuGUI_DeformedShapeAndScalarMapDlg.h
1 //  Copyright (C) 2007-2008  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.
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 //  VISU VISUGUI : GUI of VISU component
23 //  File   : VisuGUI_DeformedShapeAndScalarMapDlg.h
24 //  Author : Eugeny Nikolaev
25 //  Module : VISU
26 //
27 #ifndef VISUGUI_DEFORMEDSHAPEANDSCALARMAPDLS_H
28 #define VISUGUI_DEFORMEDSHAPEANDSCALARMAPDLS_H
29
30 #include "VisuGUI_Prs3dDlg.h"
31
32 #include "VISUConfig.hh"
33
34 #include <QDialog>
35
36 #include <set>
37 #include <vector>
38
39 class SalomeApp_Module;
40 class VisuGUI_InputPane;
41 class QtxDoubleSpinBox;
42 class QComboBox;
43 class QTabWidget;
44
45 namespace VISU
46 {
47   class DeformedShapeAndScalarMap_i;
48 }
49
50 class VisuGUI_DeformedShapeAndScalarMapDlg : public VisuGUI_ScalarBarBaseDlg
51 {
52     Q_OBJECT
53
54 public:
55     VisuGUI_DeformedShapeAndScalarMapDlg (SalomeApp_Module* theModule);
56     ~VisuGUI_DeformedShapeAndScalarMapDlg();
57
58     double getFactor() const;
59     void setFactor(double theFactor);
60     
61     virtual void initFromPrsObject( VISU::ColoredPrs3d_i* thePrs,
62                                     bool theInit );
63
64     virtual int  storeToPrsObject(VISU::ColoredPrs3d_i* thePrs);
65
66     int getCurrentScalarFieldNamePos();
67     QString getCurrentScalarFieldName();
68     int getCurrentScalarNbIterations();
69     VISU::Entity getCurrentScalarEntity();
70     void SetScalarField(int theIter,QString theFieldName=QString(""), const bool = true );
71
72     bool IsScalarFieldValid() const { return myIsScalarFieldValid; }
73
74 protected:
75   virtual QString GetContextHelpFilePath();
76
77 protected slots:
78   void accept();
79   void reject();
80
81 private slots:
82   void onFieldChanged(int i=0);
83   void onTimeStampChanged(int i=0);
84
85 private:
86  QtxDoubleSpinBox* ScalFact;
87  QTabWidget* myTabBox;
88  VisuGUI_ScalarBarPane* myScalarPane;
89  VisuGUI_InputPane*     myInputPane;
90  QComboBox *myFieldsCombo;
91  QComboBox *myTimeStampsCombo;
92  QPushButton* myButtonOk;
93  
94  typedef std::map<int, QString> TTimeStampNumber2Time; // Times map definition (iteration time, real value of time)
95  typedef std::map<QString, TTimeStampNumber2Time> TFieldName2TimeStamps; // Field name and enity to Times
96  typedef std::map<VISU::Entity, TFieldName2TimeStamps> TEntity2Fields; // Mesh to fields map
97  
98  TEntity2Fields myEntity2Fields;
99  int myCurrScalarIter;
100  bool myIsAnimation;
101  bool myUpdateScalars;
102  std::vector<int> myTimeStampID;
103  
104  _PTR(SObject) mySelectionObj;
105  SALOME::GenericObjPtr<VISU::DeformedShapeAndScalarMap_i> myPrsCopy;
106  SalomeApp_Module* myVisuGUI;
107
108  bool myIsScalarFieldValid;
109  
110 protected:
111  void UpdateScalarField();
112  void SetScalarField( const bool = true );
113  void AddAllFieldNames();
114  void AddAllTimes(const QString& theFieldName);
115  QString GetFloatValueOfTimeStamp(VISU::Entity theEntity,
116                                   const std::string& theFieldName,
117                                   int theTimeStampNumber);
118  void updateControls();
119 };
120
121 #endif // VISUGUI_DEFORMEDSHAPEDLS_H