]> SALOME platform Git repositories - modules/visu.git/blob - src/VISU_I/VISU_Evolution.h
Salome HOME
b40e9aec0a331984470172859b89a83df5759a37
[modules/visu.git] / src / VISU_I / VISU_Evolution.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 //  File   : VISU_Evolution.h
23 //  Author : Oleg UVAROV
24 //  Module : VISU
25 //
26 #ifndef VISU_EVOLUTION_H
27 #define VISU_EVOLUTION_H
28
29 #include "VISUConfig.hh"
30
31 #include <VISU_ConvertorDef_impl.hxx>
32 #include <SALOMEDSClient_Study.hxx>
33
34 #include <QList>
35 #include <QMap>
36 #include <QPair>
37
38 #include <vtkType.h>
39
40 #include <string>
41
42 class Plot2d_ViewFrame;
43
44 namespace VISU
45 {
46   class Result_i;
47 };
48
49 namespace VISU
50 {
51   typedef QMap< vtkIdType, vtkFloatingPointType >         Comp2Value;
52   typedef QMapIterator< vtkIdType, vtkFloatingPointType > Comp2ValueIterator;
53
54   typedef QMap< vtkIdType, Comp2Value >                   Elem2Comp2Value;
55   typedef QMapIterator< vtkIdType, Comp2Value >           Elem2Comp2ValueIterator;
56
57   typedef QPair< double, std::string >                    TimeStampData;
58   typedef QList< TimeStampData >                          TimeStampDataList;
59   typedef QListIterator< TimeStampData >                  TimeStampDataListIterator;
60
61   typedef QPair< QString, QString >                       ComponentData;
62   typedef QList< ComponentData >                          ComponentDataList;
63   typedef QListIterator< ComponentData >                  ComponentDataListIterator;
64
65   typedef QList< vtkFloatingPointType >                   TimeStampValueList;
66   typedef QListIterator< vtkFloatingPointType >           TimeStampValueListIterator;
67 };
68
69 class VISU_I_EXPORT VISU_Evolution
70 {
71 protected:
72   bool _showEvolution();
73
74 public:
75   VISU_Evolution( _PTR(Study) theStudy,
76                   VISU::XYPlot_ptr theXYPlot = VISU::XYPlot::_nil() );
77   ~VISU_Evolution();
78
79   virtual VISU::VISUType    GetType() { return VISU::TNONE; }
80
81   _PTR(Study)               getStudy() const { return myStudy; }
82
83   bool                      setField( _PTR(SObject) theField );
84   bool                      setField( SALOMEDS::SObject_ptr theField );
85
86   int                       getNbPoints() const;
87
88   void                      setPointId( int thePointId );
89   int                       getPointId() const { return myPointId; }
90
91   void                      setComponentId( int theComponentId );
92   int                       getComponentId() const { return myComponentId; }
93
94   bool                      showEvolution();
95
96   void                      setViewer( Plot2d_ViewFrame* theView ) { myView = theView; }
97   Plot2d_ViewFrame*         getViewer() const { return myView; }
98
99   VISU::Result_i*           getResult() const { return myResult; }
100   const VISU::PFieldImpl&   getField() const { return myFieldImpl; }
101
102   std::string               getFieldEntry() const { return myFieldEntry; }
103   std::string               getEvolutionEntry() const { return myEvolutionEntry; }
104   std::string               getMeshName() const { return myMeshName; }
105   VISU::TEntity             getEntity() const { return myEntity; }
106   std::string               getFieldName() const { return myFieldName; }
107
108   const VISU::TimeStampDataList& getTimeStampDataList() const { return myTimeStampDataList; }
109   const VISU::ComponentDataList& getComponentDataList() const { return myComponentDataList; }
110
111   void                      restoreFromStudy( SALOMEDS::SObject_ptr theObj );
112   void                      restoreFromStudy( _PTR(SObject) theObj );
113
114 private:
115   bool                      extractData( int thePointId,
116                                          int theComponentId,
117                                          VISU::TimeStampValueList& theTimeStampValueList );
118
119 private:
120   _PTR(Study)               myStudy;
121   _PTR(SObject)             myField;
122
123   int                       myPointId;
124   int                       myComponentId;
125
126   Plot2d_ViewFrame*         myView;
127
128   VISU::Result_i*           myResult;
129   VISU::PFieldImpl          myFieldImpl;
130
131   std::string               myFieldEntry;
132   std::string               myEvolutionEntry;
133   std::string               myMeshName;
134   VISU::TEntity             myEntity;
135   std::string               myFieldName;
136
137   VISU::TimeStampDataList   myTimeStampDataList;
138   VISU::ComponentDataList   myComponentDataList;
139 };
140
141
142 class VISU_I_EXPORT VISU_Evolution_i: public virtual POA_VISU::Evolution,
143                                       public virtual VISU::Base_i
144 {
145   VISU_Evolution* myEngine;
146 public:
147   VISU_Evolution_i( SALOMEDS::Study_ptr theStudy,
148                     VISU::XYPlot_ptr theXYPlot = VISU::XYPlot::_nil() );
149   ~VISU_Evolution_i();
150
151   virtual VISU::VISUType    GetType() { return VISU::TEVOLUTION; }
152
153   virtual bool              setField(SALOMEDS::SObject_ptr theField);
154
155   virtual void              setPointId(CORBA::Long thePointId);
156
157   virtual void              setComponentId(CORBA::Long theComponentId);
158
159   virtual CORBA::Boolean    showEvolution();
160
161   virtual void              restoreFromStudy(SALOMEDS::SObject_ptr theField);
162 };
163
164 #endif //VISU_EVOLUTION_H