]> SALOME platform Git repositories - modules/visu.git/blob - src/VISU_I/VISU_Gen_i.hh
Salome HOME
Fix for Bug IPAL8945
[modules/visu.git] / src / VISU_I / VISU_Gen_i.hh
1 //  Copyright (C) 2003  CEA/DEN, EDF R&D
2 //
3 //
4 //
5 //  File   : VISU_GEN_i.h file
6 //  Author : Alexey Petrov
7 //  Module : VISU
8 //  $Header:
9
10 #ifndef __VISU_GEN_I_H__
11 #define __VISU_GEN_I_H__
12
13 #include "VISUConfig.hh"
14
15 #include "SALOME_Component_i.hxx"
16 #include "SALOME_NamingService.hxx"
17
18 namespace VISU
19 {
20   class Result_i;
21   class ColoredPrs3d_i;
22
23   bool
24   CreatColoredPrs3d(ColoredPrs3d_i* theColoredPrs3d,
25                     const char* theMeshName, 
26                     VISU::Entity theEntity,
27                     const char* theFieldName, 
28                     CORBA::Double theIteration);
29
30   class VISU_Gen_i : public virtual POA_VISU::VISU_Gen,
31                      public virtual ::Engines_Component_i,
32                      public virtual Base_i
33   {
34     SALOMEDS::Study_var myStudyDocument;
35     VISU_Gen_i();
36     VISU_Gen_i(const VISU::VISU_Gen_i &);
37   public:
38     VISU_Gen_i(CORBA::ORB_ptr theORB,
39                PortableServer::POA_ptr thePOA,
40                SALOME_NamingService* theNamingService,
41                QMutex* theMutex);
42     virtual ~VISU_Gen_i();
43
44     virtual 
45     char* 
46     GetID();
47
48     virtual
49     VISU::VISUType 
50     GetType() { return VISU::TVISUGEN;};
51
52     virtual
53     void
54     SetCurrentStudy(SALOMEDS::Study_ptr theStudy);
55
56     virtual
57     SALOMEDS::Study_ptr
58     GetCurrentStudy();
59
60     virtual
61     ViewManager_ptr
62     GetViewManager();
63
64     virtual
65     SALOMEDS::SObject_ptr
66     ImportTables(const char* theFileName);
67
68     virtual
69     CORBA::Boolean
70     ExportTableToFile(SALOMEDS::SObject_ptr theTable, 
71                       const char* theFileName );
72
73     //Create Result
74     virtual 
75     Result_ptr
76     ImportFile(const char* theFileName);
77
78     virtual
79     Result_ptr
80     CreateResult(const char* theFileName);
81
82     virtual
83     Result_ptr
84     CopyAndImportFile(const char* theFileName);
85
86     virtual
87     Result_ptr
88     ImportMed(SALOMEDS::SObject_ptr theMedSObject);
89
90     virtual
91     Result_ptr
92     ImportMedField(SALOME_MED::FIELD_ptr theField);
93
94
95     //Create Presentation Of Submeshes
96     virtual
97     Mesh_ptr
98     MeshOnEntity(Result_ptr theResult, 
99                  const char* theMeshName, 
100                  VISU::Entity theEntity);
101
102     virtual
103     Mesh_ptr
104     FamilyMeshOnEntity(Result_ptr theResult, 
105                        const char* theMeshName,
106                        VISU::Entity theEntity, 
107                        const char* theFamilyName);
108
109     virtual
110     Mesh_ptr
111     GroupMesh(Result_ptr theResult, 
112               const char* theMeshName, 
113               const char* theGroupName);
114
115     //Create 3D collored Presentation Of Different Types
116     template<typename TPrs3d_i> TPrs3d_i*
117     CreatePrs3d(Result_ptr theResult, 
118                 const char* theMeshName, 
119                 VISU::Entity theEntity,
120                 const char* theFieldName, 
121                 CORBA::Double theIteration, 
122                 bool theAddToStudy = true)
123     {
124       if(myStudyDocument->GetProperties()->IsLocked()) 
125         return NULL;
126
127       typedef typename TPrs3d_i::TInterface TPrs3d;
128       typename TPrs3d::_var_type aPrs3d;
129       Mutex mt(myMutex);
130       if(Result_i* aResult = dynamic_cast<Result_i*>(GetServant(theResult).in())){
131         if(TPrs3d_i::IsPossible(aResult,theMeshName,theEntity,theFieldName,int(theIteration))){
132           TPrs3d_i* aPresent = new TPrs3d_i(aResult,theAddToStudy);
133           if(CreatColoredPrs3d(aPresent,theMeshName,theEntity,theFieldName,theIteration))
134             return aPresent;
135           aPresent->_remove_ref();
136         }
137       }
138       return NULL;
139     }
140
141     template<typename TPrs3d_i> typename TPrs3d_i::TInterface::_var_type
142     Prs3dOnField(Result_ptr theResult, 
143                  const char* theMeshName, 
144                  VISU::Entity theEntity,
145                  const char* theFieldName, 
146                  CORBA::Double theIteration, 
147                  bool theAddToStudy = true)
148     {
149       typedef typename TPrs3d_i::TInterface TPrs3d;
150       typename TPrs3d::_var_type aPrs3d;
151       if(TPrs3d_i* aPrs3d = CreatePrs3d<TPrs3d_i>(theResult,theMeshName,theEntity,theFieldName,theIteration,theAddToStudy))
152         return aPrs3d->_this();
153       return TPrs3d::_nil();
154     }
155
156     virtual
157     ScalarMap_ptr
158     ScalarMapOnField(Result_ptr theResult,
159                      const char* theMeshName, 
160                      VISU::Entity theEntity,
161                      const char* theFieldName, 
162                      CORBA::Double theIteration);
163
164     virtual
165     GaussPoints_ptr
166     GaussPointsOnField(Result_ptr theResult,
167                        const char* theMeshName, 
168                        VISU::Entity theEntity,
169                        const char* theFieldName, 
170                        CORBA::Double theIteration);
171
172     virtual
173     DeformedShape_ptr
174     DeformedShapeOnField(Result_ptr theResult,
175                          const char* theMeshName, 
176                          VISU::Entity theEntity,
177                          const char* theFieldName, 
178                          CORBA::Double theIteration);
179
180     virtual
181     ScalarMapOnDeformedShape_ptr
182     ScalarMapOnDeformedShapeOnField(Result_ptr theResult,
183                                     const char* theMeshName, 
184                                     VISU::Entity theEntity,
185                                     const char* theFieldName, 
186                                     CORBA::Double theIteration);
187     virtual
188     Vectors_ptr
189     VectorsOnField(Result_ptr theResult,
190                    const char* theMeshName, 
191                    VISU::Entity theEntity,
192                    const char* theFieldName, 
193                    CORBA::Double theIteration);
194
195     virtual
196     IsoSurfaces_ptr
197     IsoSurfacesOnField(Result_ptr theResult,
198                        const char* theMeshName, 
199                        VISU::Entity theEntity,
200                        const char* theFieldName, 
201                        CORBA::Double theIteration);
202
203     virtual
204     CutPlanes_ptr
205     CutPlanesOnField(Result_ptr theResult,
206                      const char* theMeshName, 
207                      VISU::Entity theEntity,
208                      const char* theFieldName, 
209                      CORBA::Double theIteration);
210
211     virtual
212     CutLines_ptr
213     CutLinesOnField(Result_ptr theResult,
214                     const char* theMeshName, 
215                     VISU::Entity theEntity,
216                     const char* theFieldName, 
217                     CORBA::Double theIteration);
218
219     virtual
220     StreamLines_ptr
221     StreamLinesOnField(Result_ptr theResult,
222                        const char* theMeshName, 
223                        VISU::Entity theEntity,
224                        const char* theFieldName, 
225                        CORBA::Double theIteration);
226
227     virtual
228     Plot3D_ptr
229     Plot3DOnField(Result_ptr theResult,
230                   const char* theMeshName, 
231                   VISU::Entity theEntity,
232                   const char* theFieldName, 
233                   CORBA::Double theIteration);
234
235     //Create Digital Presentation
236     virtual 
237     Table_ptr
238     CreateTable(const char* theTableEntry);
239
240     virtual
241     Curve_ptr
242     CreateCurve(Table_ptr theTable, 
243                 CORBA::Long theHRow, 
244                 CORBA::Long theVRow);
245
246     virtual
247     Container_ptr 
248     CreateContainer();
249
250     virtual
251     Animation_ptr
252     CreateAnimation(View3D_ptr theView3d);
253
254     virtual
255     void 
256     DeleteResult(Result_ptr theResult);
257
258     virtual
259     void 
260     DeletePrs3d(Prs3d_ptr thePrs3d);
261
262     // inherited methods from Engines::Component
263     virtual
264     Engines::TMPFile*
265     DumpPython(CORBA::Object_ptr theStudy,
266                CORBA::Boolean theIsPublished,
267                CORBA::Boolean& theIsValidScript);
268
269     // inherited methods from SALOMEDS::Driver
270     virtual
271     SALOMEDS::TMPFile* 
272     Save(SALOMEDS::SComponent_ptr theComponent,
273          const char* theURL,
274          bool isMultiFile);
275
276     virtual
277     SALOMEDS::TMPFile* 
278     SaveASCII(SALOMEDS::SComponent_ptr theComponent,
279               const char* theURL,
280               bool isMultiFile);
281
282     virtual
283     bool
284     Load(SALOMEDS::SComponent_ptr,
285          const SALOMEDS::TMPFile &,
286          const char* theURL,
287          bool isMultiFile);
288
289     virtual
290     bool
291     LoadASCII(SALOMEDS::SComponent_ptr,
292               const SALOMEDS::TMPFile &,
293               const char* theURL,
294               bool isMultiFile);
295     
296     virtual
297     void
298     Close(SALOMEDS::SComponent_ptr IORSComponent);
299
300     virtual
301     char* 
302     ComponentDataType();
303
304     virtual
305     char* 
306     IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject,
307                            const char* IORString,
308                            CORBA::Boolean isMultiFile,
309                            CORBA::Boolean isASCII);
310
311     virtual
312     char* 
313     LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject,
314                            const char* aLocalPersistentID,
315                            CORBA::Boolean isMultiFile,
316                            CORBA::Boolean isASCII);
317
318     virtual 
319     bool
320     CanPublishInStudy(CORBA::Object_ptr theIOR);
321
322     virtual
323     SALOMEDS::SObject_ptr
324     PublishInStudy(SALOMEDS::Study_ptr theStudy,
325                    SALOMEDS::SObject_ptr theSObject,
326                    CORBA::Object_ptr theObject,
327                    const char* theName) throw (SALOME::SALOME_Exception);
328
329     CORBA::Boolean 
330     CanCopy(SALOMEDS::SObject_ptr theObject);
331
332     SALOMEDS::TMPFile* 
333     CopyFrom(SALOMEDS::SObject_ptr theObject, 
334              CORBA::Long& theObjectID);
335
336     CORBA::Boolean 
337     CanPaste(const char* theComponentName, 
338              CORBA::Long theObjectID);
339
340     SALOMEDS::SObject_ptr
341     PasteInto(const SALOMEDS::TMPFile& theStream,
342               CORBA::Long theObjectID,
343               SALOMEDS::SObject_ptr theObject);
344   };
345 }
346
347 #endif