]> SALOME platform Git repositories - modules/visu.git/blob - src/VISU_I/VISU_Result_i.hh
Salome HOME
Fix for Bug IPAL8945
[modules/visu.git] / src / VISU_I / VISU_Result_i.hh
1 //  VISU OBJECT : interactive object for VISU entities implementation
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 //  File   : VISU_Result_i.hh
24 //  Author : Alexey PETROV
25 //  Module : VISU
26
27 #ifndef __VISU_RESULT_I_H__
28 #define __VISU_RESULT_I_H__
29
30 #include "VISUConfig.hh"
31 #include "SALOME_GenericObj_i.hh"
32
33 #include <boost/signals/trackable.hpp>
34 #include <boost/signals/signal0.hpp>
35
36 #include <gp_Dir.hxx>
37 #include <vector>
38
39 class VISU_Convertor;
40
41 namespace VISU
42 {
43   //----------------------------------------------------------------------------
44   class MinMaxCunsomer: public virtual boost::bsignals::trackable
45   {
46   protected:
47     bool myMinMaxIsInitilized;
48     MinMaxCunsomer();
49
50   public:
51     virtual
52     bool
53     IsMinMaxInitilized();
54
55     virtual
56     void
57     UpdateMinMax();
58   };
59
60
61   //----------------------------------------------------------------------------
62   class Result_i : public virtual POA_VISU::Result,
63                    public virtual RemovableObject_i,
64                    public virtual SALOME::GenericObj_i
65   {
66     Result_i();
67     Result_i(const Result_i &);
68
69   public:
70     enum ESourceId {eRestoredComponent = -2, eRestoredFile = -1, eFile = 1, eComponent = 2};
71     enum ECreationId {eImportFile, eCopyAndImportFile, eImportMed, eImportMedField};
72
73     Result_i(SALOMEDS::Study_ptr theStudy,
74              const ESourceId& theSourceId,
75              const ECreationId& theCreationId,
76              CORBA::Boolean theIsBuildImmediately = true);
77
78     virtual ~Result_i();
79     virtual void RemoveFromStudy();
80
81     virtual VISU::VISUType GetType() { return VISU::TRESULT;}
82     virtual CORBA::Boolean BuildAll();
83
84     virtual CORBA::Boolean Build(CORBA::Boolean theIsBuildAll,
85                                  CORBA::Boolean theIsAtOnce);
86     virtual CORBA::Boolean IsDone();
87
88     virtual CORBA::Boolean IsEntitiesDone();
89
90     virtual void SetBuildFields(CORBA::Boolean theIsBuildFields, 
91                                 CORBA::Boolean theIsCalculateMinMax);
92     virtual CORBA::Boolean IsFieldsDone();
93
94     virtual void SetBuildGroups(CORBA::Boolean theIsBuildGroups);
95     virtual CORBA::Boolean IsGroupsDone();
96
97     virtual CORBA::Boolean IsMinMaxDone();
98
99     virtual 
100     void
101     MinMaxConnect(MinMaxCunsomer* theMinMaxCunsomer);
102
103     typedef boost::signal0<void> TUpdateMinMaxSignal;
104
105     typedef VISU_Convertor TInput;
106
107   private:
108     ESourceId mySourceId;
109     ECreationId myCreationId;
110
111     TInput *myInput;
112     std::string myName, myInitFileName;
113     QFileInfo myFileInfo;
114
115   protected:
116     virtual Storable* Build(SALOMEDS::SObject_ptr theSObject,
117                             CORBA::Boolean theIsAtOnce = true) ;
118     virtual Storable* BuildAll(SALOMEDS::SObject_ptr theSObject) ;
119
120     _PTR(Study) myStudy;
121     CORBA::Boolean myIsBuildImmediately;
122
123     CORBA::Boolean myIsEntitiesDone;
124     CORBA::Boolean myIsFieldsDone;
125     CORBA::Boolean myIsGroupsDone;
126     CORBA::Boolean myIsMinMaxDone;
127
128     CORBA::Boolean myIsBuildFields;
129     CORBA::Boolean myIsBuildGroups;
130
131     CORBA::Boolean myIsBuildMinMax;
132     TUpdateMinMaxSignal myUpdateMinMaxSignal;
133
134     CORBA::Boolean myIsAllDone;
135
136   public:
137     virtual int IsPossible();
138
139     virtual Storable* Create(const char* theFileName);
140     virtual Storable* Create(SALOMEDS::SObject_ptr theMedSObject);
141     virtual Storable* Create(SALOME_MED::FIELD_ptr theField);
142
143     virtual Storable* Restore(SALOMEDS::SObject_ptr theSObject,
144                               const Storable::TRestoringMap& theMap,
145                               const std::string& thePrefix);
146
147     static Storable* Restore(SALOMEDS::SObject_ptr theSObject,
148                              const std::string& thePrefix,
149                              const Storable::TRestoringMap& theMap);
150
151     virtual void ToStream(std::ostringstream& theStr);
152     virtual const char* GetComment() const;
153     static const std::string myComment;
154     TInput* GetInput();
155
156     const std::string& GetName() const { return myName;}
157     const QFileInfo& GetFileInfo() const { return myFileInfo;}
158     const std::string& GetFileName() const { return myInitFileName;}
159     const ECreationId& GetCreationId() const { return myCreationId;}
160
161   private:
162     SALOMEDS::SObject_var mySObject;
163     SALOMEDS::Study_var myStudyDocument;
164     SALOMEDS::SComponent_var mySComponent;
165
166   public:
167     std::string GetRefFatherEntry();
168     std::string GetEntry();
169     const SALOMEDS::SObject_var& GetSObject() const;
170     const SALOMEDS::Study_var& GetStudyDocument() const;
171     const SALOMEDS::SComponent_var& GetSComponent() const;
172     std::string GetEntry(const std::string& theComment);
173
174     // Info on structured mesh contained in TInput
175   public:
176     typedef enum { AXIS_X = 0, AXIS_Y, AXIS_Z } TAxis;
177     const std::vector< float >* GetAxisInfo(const std::string& theMeshName,
178                                             TAxis              theAxis,
179                                             gp_Dir&            thePlaneNormal);
180     // Return i,j or k values and cutting plane normal for theAxis.
181     // In the case of any problems, return NULL pointer
182   private:
183     struct TGridInfo {
184       std::vector< float > myComponets[ 3 ];
185       gp_Dir               myAxis     [ 3 ];
186     };
187     map< string, TGridInfo > myMeshName2GridInfoMap;
188   };
189
190   Result_var FindResult(SALOMEDS::SObject_ptr theSObject);
191 }
192
193 #endif