Salome HOME
Join modifications from branch OCC_development_for_3_2_0a2
[modules/visu.git] / src / VISUGUI / VisuGUI_ScalarMapOnDeformedShapeDlg.h
1 //  VISU VISUGUI : GUI of VISU component
2 //
3 //  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
21 //
22 //
23 //
24 //  File   : VisuGUI_ScalarMapOnDeformedShapeDlg.h
25 //  Author : Eugeny Nikolaev
26 //  Module : VISU
27
28 #ifndef VISUGUI_SCALARMAPONDEFORMEDSHAPEDLS_H
29 #define VISUGUI_SCALARMAPONDEFORMEDSHAPEDLS_H
30
31 #include "VisuGUI_ScalarBarDlg.h"
32
33 #include "QtxDblSpinBox.h"
34
35 #include <qdialog.h>
36 #include <qgroupbox.h>
37 #include <qcheckbox.h>
38 #include <qlabel.h>
39 #include <qpushbutton.h>
40
41 #include <set>
42
43 class SalomeApp_Module;
44 class QComboBox;
45 class QString;
46
47 namespace VISU{
48   class ScalarMapOnDeformedShape_i;
49 }
50
51 class VisuGUI_ScalarMapOnDeformedShapeDlg : public QDialog
52 {
53     Q_OBJECT
54
55 public:
56     VisuGUI_ScalarMapOnDeformedShapeDlg (SalomeApp_Module* theModule);
57     ~VisuGUI_ScalarMapOnDeformedShapeDlg() {};
58
59     double getFactor()
60       { return ScalFact->value(); }
61     void setFactor(double theFactor)
62       { ScalFact->setValue(theFactor); }
63     
64
65     void initFromPrsObject(VISU::ScalarMapOnDeformedShape_i* thePrs,bool isAnim=false);
66     int storeToPrsObject(VISU::ScalarMapOnDeformedShape_i* thePrs,bool theUpdateScalars=true,int theIter=1);
67
68     int getCurrentScalarFieldNamePos();
69     QString getCurrentScalarFieldName();
70     int getCurrentScalarNbIterations();
71     VISU::TEntity getCurrentScalarEntity();
72     void SetScalarField(int theIter,QString theFieldName=QString(""));
73
74 protected slots:
75   void accept();
76   void reject();
77
78 private slots:
79   void onFieldChanged(int i=0);
80   void onTimeStampChanged(int i=0);
81
82 private:
83  QtxDblSpinBox* ScalFact;
84  VisuGUI_ScalarBarPane* myScalarPane;
85  QComboBox *myFieldsCombo;
86  QComboBox *myTimeStampsCombo;
87  
88  typedef std::map<int,float> TTL; // Times map definition (iteration time, real value of time)
89  typedef std::pair<QString,VISU::TEntity> TFE; // pair field name and entity
90  typedef std::map<TFE,TTL> TFT; // Field name and enity to Times
91  typedef std::map<QString,TFT> TMF; // Mesh to fields map
92  
93  TMF myMeshFieldsTimes;
94  QString myCurrMeshName;
95  int myCurrScalarIter;
96  bool myIsAnimation;
97  
98  _PTR(SObject) mySelectionObj;
99  VISU::ScalarMapOnDeformedShape_i* myPrs;
100  SalomeApp_Module* myVisuGUI;
101  
102 protected:
103  void UpdateScalarField();
104  void SetScalarField();
105  void AddAllFieldNames();
106  void AddAllTimes(const QString& theFieldName);
107  float GetFloatValueOfTimeStamp(const char* theMeshName,
108                                 const char* theFieldName,
109                                 const int   theIteration,
110                                 const VISU::TEntity  theEntity);
111 };
112
113 #endif // VISUGUI_DEFORMEDSHAPEDLS_H