Salome HOME
Update copyright information
[modules/visu.git] / src / VISUGUI / VisuGUI_DeformedShapeAndScalarMapDlg.h
1 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 //  VISU VISUGUI : GUI of VISU component
21 //  File   : VisuGUI_DeformedShapeAndScalarMapDlg.h
22 //  Author : Eugeny Nikolaev
23 //  Module : VISU
24 //
25 #ifndef VISUGUI_DEFORMEDSHAPEANDSCALARMAPDLS_H
26 #define VISUGUI_DEFORMEDSHAPEANDSCALARMAPDLS_H
27
28 #include "VisuGUI_Prs3dDlg.h"
29
30 #include "VISUConfig.hh"
31
32 #include <QDialog>
33
34 #include <set>
35 #include <vector>
36
37 class SalomeApp_Module;
38 class VisuGUI_InputPane;
39 class SalomeApp_DoubleSpinBox;
40 class QComboBox;
41 class QTabWidget;
42
43 namespace VISU
44 {
45   class DeformedShapeAndScalarMap_i;
46 }
47
48 class VisuGUI_DeformedShapeAndScalarMapDlg : public VisuGUI_ScalarBarBaseDlg
49 {
50     Q_OBJECT
51
52 public:
53     VisuGUI_DeformedShapeAndScalarMapDlg (SalomeApp_Module* theModule);
54     ~VisuGUI_DeformedShapeAndScalarMapDlg();
55
56     double getFactor() const;
57     void setFactor(double theFactor);
58     
59     virtual void initFromPrsObject( VISU::ColoredPrs3d_i* thePrs,
60                                     bool theInit );
61
62     virtual int  storeToPrsObject(VISU::ColoredPrs3d_i* thePrs);
63
64     int getCurrentScalarFieldNamePos();
65     QString getCurrentScalarFieldName();
66     int getCurrentScalarNbIterations();
67     VISU::Entity getCurrentScalarEntity();
68     void SetScalarField(int theIter,QString theFieldName=QString(""), const bool = true );
69
70     bool IsScalarFieldValid() const { return myIsScalarFieldValid; }
71
72 protected:
73   virtual QString GetContextHelpFilePath();
74
75 protected slots:
76   void accept();
77   void reject();
78
79 private slots:
80   void onFieldChanged(int i=0);
81   void onTimeStampChanged(int i=0);
82
83 private:
84  SalomeApp_DoubleSpinBox* ScalFact;
85  QTabWidget* myTabBox;
86  VisuGUI_ScalarBarPane* myScalarPane;
87  VisuGUI_InputPane*     myInputPane;
88  QComboBox *myFieldsCombo;
89  QComboBox *myTimeStampsCombo;
90  QPushButton* myButtonOk;
91  
92  typedef std::map<int, QString> TTimeStampNumber2Time; // Times map definition (iteration time, real value of time)
93  typedef std::map<QString, TTimeStampNumber2Time> TFieldName2TimeStamps; // Field name and enity to Times
94  typedef std::map<VISU::Entity, TFieldName2TimeStamps> TEntity2Fields; // Mesh to fields map
95  
96  TEntity2Fields myEntity2Fields;
97  int myCurrScalarIter;
98  bool myIsAnimation;
99  bool myUpdateScalars;
100  std::vector<int> myTimeStampID;
101  
102  _PTR(SObject) mySelectionObj;
103  SALOME::GenericObjPtr<VISU::DeformedShapeAndScalarMap_i> myPrsCopy;
104  SalomeApp_Module* myVisuGUI;
105
106  bool myIsScalarFieldValid;
107  
108 protected:
109  void UpdateScalarField();
110  void SetScalarField( const bool = true );
111  void AddAllFieldNames();
112  void AddAllTimes(const QString& theFieldName);
113  QString GetFloatValueOfTimeStamp(VISU::Entity theEntity,
114                                   const std::string& theFieldName,
115                                   int theTimeStampNumber);
116  void updateControls();
117 };
118
119 #endif // VISUGUI_DEFORMEDSHAPEDLS_H