Salome HOME
af5ba0e214d8ee860b70f4a217baa8e49a504f52
[modules/visu.git] / src / VISU_I / VISU_MultiResult_i.hh
1 // Copyright (C) 2007-2011  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 OBJECT : interactive object for VISU entities implementation
21 //  File   : VISU_MultiResult_i.hh
22 //  Author : Alexey PETROV
23 //  Module : VISU
24 //
25 #ifndef __VISU_MULTI_RESULT_I_H__
26 #define __VISU_MULTI_RESULT_I_H__
27
28 #ifndef ENABLE_MULTIPR
29 #  define RESULT_CLASS_NAME Result_i
30 #else
31 #  define RESULT_CLASS_NAME MultiResult_i
32
33 #include "VISU_Result_i.hh"
34 #include "MULTIPR_Obj.hxx"
35
36 #include <set>
37
38 namespace VISU
39 {
40   //----------------------------------------------------------------------------
41   class MultiResult_i : public virtual Result_i
42   {
43     MultiResult_i(const MultiResult_i&);
44
45   public:
46     typedef Result_i TSuperClass;
47
48     MultiResult_i(SALOMEDS::Study_ptr theStudy,
49                   const ESourceId& theSourceId,
50                   const ECreationId& theCreationId,
51                   CORBA::Boolean theIsBuildImmediately,
52                   CORBA::Boolean theIsBuildFields,
53                   CORBA::Boolean theIsBuildMinMax,
54                   CORBA::Boolean theIsBuildGroups);
55
56     MultiResult_i();
57
58     virtual
59     ~MultiResult_i();
60
61     virtual
62     CORBA::Boolean
63     IsDone();
64
65     virtual
66     VISU::Result::EntityNames* 
67     GetPartNames(const char* theMeshName);
68
69     virtual
70     VISU::Result::Resolutions* 
71     GetResolutions(const char* theMeshName, 
72                    const char* thePartName);
73
74     virtual
75     VISU::Result::Resolution
76     GetResolution(const char* theMeshName, 
77                   const char* thePartName);
78
79     virtual
80     void 
81     SetResolution(const char* theMeshName, 
82                   const char* thePartName, 
83                   VISU::Result::Resolution theResolution);
84
85
86     typedef std::string TPartName;
87     typedef std::vector<TPartName> TPartNames;
88
89     typedef size_t TPartID;
90     typedef std::string TPath;
91     typedef std::string TMeshName;
92
93     struct TPartInfo
94     {
95       TMeshName myMeshName;
96       TPartName myName;
97       TPartID myPartID;
98       TPath myPath;
99       TFileName myFileName;
100     };
101
102     typedef std::map<TFileName, TPartInfo> TPartInfos;
103     TPartInfos myPartInfos;
104
105     typedef std::map<TPartName, TFileName> TPartName2FileName;
106     typedef std::map<TPartName, VISU::Result::Resolution> TPartName2Resolution;
107     typedef std::set<VISU::Result::Resolution> TResolutions;
108
109     typedef std::set<std::string> TRepresentationKey;
110     typedef std::map<TRepresentationKey, PInput> TRepresentation2Input;
111
112     typedef std::set<TPartName> TSubPartNames;
113     typedef std::map<TPartName, TSubPartNames> TMainPart2SubPartNames;
114
115   private:
116     multipr::Obj myMultiprObj;
117     TPartName2FileName myPartName2FileName;
118     TPartName2Resolution myPartName2Resolution;
119     TMainPart2SubPartNames myMainPart2SubPartNames;
120
121     TRepresentation2Input myRepresentation2Input;
122
123   protected:
124     virtual
125     Storable* 
126     Build(SALOMEDS::SObject_ptr theSObject,
127           CORBA::Boolean theIsAtOnce = true) ;
128
129     virtual
130     void
131     BuildDataTree(const std::string& theResultEntry);
132
133   public:
134     virtual 
135     size_t
136     IsPossible();
137
138     virtual
139     Storable* 
140     Create(const char* theFileName);
141
142     virtual 
143     Storable*
144     Restore(SALOMEDS::SObject_ptr theSObject,
145             const Storable::TRestoringMap& theMap,
146             const std::string& thePrefix,
147             CORBA::Boolean theIsMultiFile);
148
149     //---------------------------------------------------------------
150     virtual 
151     bool
152     Save(SALOMEDS::SComponent_ptr theComponent,
153          const std::string& theURL,
154          bool theIsMultiFile,
155          bool theIsASCII,
156          TFileNames& theFileNames,
157          TFileNames& theFiles);
158
159     virtual 
160     CORBA::Boolean 
161     CanCopy(SALOMEDS::SObject_ptr theObject);
162
163     virtual
164     void
165     ToStream(std::ostringstream& theStr);
166
167     virtual
168     PInput
169     GetInput(const std::string& theMeshName = "",
170              VISU::Entity theEntity = VISU::NONE,
171              const std::string& theFieldName = "", 
172              CORBA::Long theTimeStampNumber = -1);
173   };
174
175 }
176
177 #endif // ENABLE_MULTIPR
178
179 #endif // __VISU_MULTI_RESULT_I_H__