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