]> SALOME platform Git repositories - modules/visu.git/blob - src/VISU_I/VISU_Gen_i.hh
Salome HOME
Join modifications from branch BR_DEBUG_3_2_0b1
[modules/visu.git] / src / VISU_I / VISU_Gen_i.hh
1 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
3 // 
4 //  This library is free software; you can redistribute it and/or 
5 //  modify it under the terms of the GNU Lesser General Public 
6 //  License as published by the Free Software Foundation; either 
7 //  version 2.1 of the License. 
8 // 
9 //  This library is distributed in the hope that it will be useful, 
10 //  but WITHOUT ANY WARRANTY; without even the implied warranty of 
11 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
12 //  Lesser General Public License for more details. 
13 // 
14 //  You should have received a copy of the GNU Lesser General Public 
15 //  License along with this library; if not, write to the Free Software 
16 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
17 // 
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 //
20 //  File   : VISU_Gen_i.hh
21 //  Author : Alexey Petrov
22 //  Module : VISU
23
24 #ifndef __VISU_GEN_I_H__
25 #define __VISU_GEN_I_H__
26
27 #include "VISUConfig.hh"
28
29 #include "SALOME_Component_i.hxx"
30 #include "SALOME_NamingService.hxx"
31
32 #include <string>
33
34 namespace VISU
35 {
36   class Result_i;
37   class ColoredPrs3d_i;
38
39   bool
40   CreatColoredPrs3d(ColoredPrs3d_i* theColoredPrs3d,
41                     const char* theMeshName, 
42                     VISU::Entity theEntity,
43                     const char* theFieldName, 
44                     CORBA::Double theIteration);
45
46   class VISU_Gen_i : public virtual POA_VISU::VISU_Gen,
47                      public virtual ::Engines_Component_i,
48                      public virtual Base_i
49   {
50     SALOMEDS::Study_var myStudyDocument;
51     VISU_Gen_i();
52     VISU_Gen_i(const VISU::VISU_Gen_i &);
53   public:
54     VISU_Gen_i(CORBA::ORB_ptr theORB,
55                PortableServer::POA_ptr thePOA,
56                SALOME_NamingService* theNamingService,
57                QMutex* theMutex);
58     virtual ~VISU_Gen_i();
59
60     virtual 
61     char* 
62     GetID();
63
64     virtual
65     VISU::VISUType 
66     GetType() { return VISU::TVISUGEN;};
67
68     virtual
69     void
70     SetCurrentStudy(SALOMEDS::Study_ptr theStudy);
71
72     virtual
73     SALOMEDS::Study_ptr
74     GetCurrentStudy();
75
76     virtual
77     ViewManager_ptr
78     GetViewManager();
79
80     virtual
81     SALOMEDS::SObject_ptr
82     ImportTables(const char* theFileName);
83
84     virtual
85     CORBA::Boolean
86     ExportTableToFile(SALOMEDS::SObject_ptr theTable, 
87                       const char* theFileName );
88
89     //Create Result
90     virtual 
91     Result_ptr
92     ImportFile(const char* theFileName);
93
94     virtual
95     Result_ptr
96     CreateResult(const char* theFileName);
97
98     virtual
99     Result_ptr
100     CopyAndImportFile(const char* theFileName);
101
102     virtual
103     Result_ptr
104     ImportMed(SALOMEDS::SObject_ptr theMedSObject);
105
106     virtual
107     Result_ptr
108     ImportMedField(SALOME_MED::FIELD_ptr theField);
109
110
111     //Rename Presentation Of Submeshes
112     void
113     RenameMeshInStudy(Result_ptr  theResult,
114                       std::string theMeshName,
115                       int         theEntity,      // -1 for group indication
116                       std::string theSubMeshName, // Family or Group name
117                       std::string theNewName);
118     virtual
119     void
120     RenameEntityInStudy(Result_ptr   theResult,
121                         const char*  theMeshName,
122                         VISU::Entity theEntity,
123                         const char*  theNewName);
124     virtual
125     void
126     RenameFamilyInStudy(Result_ptr   theResult,
127                         const char*  theMeshName,
128                         VISU::Entity theEntity,
129                         const char*  theFamilyName,
130                         const char*  theNewName);
131     virtual
132     void
133     RenameGroupInStudy(Result_ptr  theResult,
134                        const char* theMeshName,
135                        const char* theGroupName,
136                        const char* theNewName);
137
138     //Create Presentation Of Submeshes
139     virtual
140     Mesh_ptr
141     MeshOnEntity(Result_ptr theResult, 
142                  const char* theMeshName, 
143                  VISU::Entity theEntity);
144
145     virtual
146     Mesh_ptr
147     FamilyMeshOnEntity(Result_ptr theResult, 
148                        const char* theMeshName,
149                        VISU::Entity theEntity, 
150                        const char* theFamilyName);
151
152     virtual
153     Mesh_ptr
154     GroupMesh(Result_ptr theResult, 
155               const char* theMeshName, 
156               const char* theGroupName);
157
158     //Create 3D collored Presentation Of Different Types
159     template<typename TPrs3d_i> TPrs3d_i*
160     CreatePrs3d(Result_ptr theResult, 
161                 const char* theMeshName, 
162                 VISU::Entity theEntity,
163                 const char* theFieldName, 
164                 CORBA::Double theIteration, 
165                 bool theAddToStudy = true)
166     {
167       if(myStudyDocument->GetProperties()->IsLocked()) 
168         return NULL;
169
170       typedef typename TPrs3d_i::TInterface TPrs3d;
171       typename TPrs3d::_var_type aPrs3d;
172       Mutex mt(myMutex);
173       if(Result_i* aResult = dynamic_cast<Result_i*>(GetServant(theResult).in())){
174         if(TPrs3d_i::IsPossible(aResult,theMeshName,theEntity,theFieldName,int(theIteration))){
175           TPrs3d_i* aPresent = new TPrs3d_i(aResult,theAddToStudy);
176           if(CreatColoredPrs3d(aPresent,theMeshName,theEntity,theFieldName,theIteration))
177             return aPresent;
178           aPresent->_remove_ref();
179         }
180       }
181       return NULL;
182     }
183
184     template<typename TPrs3d_i> typename TPrs3d_i::TInterface::_var_type
185     Prs3dOnField(Result_ptr theResult, 
186                  const char* theMeshName, 
187                  VISU::Entity theEntity,
188                  const char* theFieldName, 
189                  CORBA::Double theIteration, 
190                  bool theAddToStudy = true)
191     {
192       typedef typename TPrs3d_i::TInterface TPrs3d;
193       typename TPrs3d::_var_type aPrs3d;
194       if(TPrs3d_i* aPrs3d = CreatePrs3d<TPrs3d_i>(theResult,theMeshName,theEntity,theFieldName,theIteration,theAddToStudy))
195         return aPrs3d->_this();
196       return TPrs3d::_nil();
197     }
198
199     virtual
200     ScalarMap_ptr
201     ScalarMapOnField(Result_ptr theResult,
202                      const char* theMeshName, 
203                      VISU::Entity theEntity,
204                      const char* theFieldName, 
205                      CORBA::Double theIteration);
206
207     virtual
208     GaussPoints_ptr
209     GaussPointsOnField(Result_ptr theResult,
210                        const char* theMeshName, 
211                        VISU::Entity theEntity,
212                        const char* theFieldName, 
213                        CORBA::Double theIteration);
214
215     virtual
216     DeformedShape_ptr
217     DeformedShapeOnField(Result_ptr theResult,
218                          const char* theMeshName, 
219                          VISU::Entity theEntity,
220                          const char* theFieldName, 
221                          CORBA::Double theIteration);
222
223     virtual
224     ScalarMapOnDeformedShape_ptr
225     ScalarMapOnDeformedShapeOnField(Result_ptr theResult,
226                                     const char* theMeshName, 
227                                     VISU::Entity theEntity,
228                                     const char* theFieldName, 
229                                     CORBA::Double theIteration);
230     virtual
231     Vectors_ptr
232     VectorsOnField(Result_ptr theResult,
233                    const char* theMeshName, 
234                    VISU::Entity theEntity,
235                    const char* theFieldName, 
236                    CORBA::Double theIteration);
237
238     virtual
239     IsoSurfaces_ptr
240     IsoSurfacesOnField(Result_ptr theResult,
241                        const char* theMeshName, 
242                        VISU::Entity theEntity,
243                        const char* theFieldName, 
244                        CORBA::Double theIteration);
245
246     virtual
247     CutPlanes_ptr
248     CutPlanesOnField(Result_ptr theResult,
249                      const char* theMeshName, 
250                      VISU::Entity theEntity,
251                      const char* theFieldName, 
252                      CORBA::Double theIteration);
253
254     virtual
255     CutLines_ptr
256     CutLinesOnField(Result_ptr theResult,
257                     const char* theMeshName, 
258                     VISU::Entity theEntity,
259                     const char* theFieldName, 
260                     CORBA::Double theIteration);
261
262     virtual
263     StreamLines_ptr
264     StreamLinesOnField(Result_ptr theResult,
265                        const char* theMeshName, 
266                        VISU::Entity theEntity,
267                        const char* theFieldName, 
268                        CORBA::Double theIteration);
269
270     virtual
271     Plot3D_ptr
272     Plot3DOnField(Result_ptr theResult,
273                   const char* theMeshName, 
274                   VISU::Entity theEntity,
275                   const char* theFieldName, 
276                   CORBA::Double theIteration);
277
278     //Create Digital Presentation
279     virtual 
280     Table_ptr
281     CreateTable(const char* theTableEntry);
282
283     virtual
284     Curve_ptr
285     CreateCurve(Table_ptr theTable, 
286                 CORBA::Long theHRow, 
287                 CORBA::Long theVRow);
288
289     virtual
290     Container_ptr 
291     CreateContainer();
292
293     virtual
294     Animation_ptr
295     CreateAnimation(View3D_ptr theView3d);
296
297     virtual
298     void 
299     DeleteResult(Result_ptr theResult);
300
301     virtual
302     void 
303     DeletePrs3d(Prs3d_ptr thePrs3d);
304
305     // inherited methods from Engines::Component
306     virtual
307     Engines::TMPFile*
308     DumpPython(CORBA::Object_ptr theStudy,
309                CORBA::Boolean theIsPublished,
310                CORBA::Boolean& theIsValidScript);
311
312     // inherited methods from SALOMEDS::Driver
313     virtual
314     SALOMEDS::TMPFile* 
315     Save(SALOMEDS::SComponent_ptr theComponent,
316          const char* theURL,
317          bool isMultiFile);
318
319     virtual
320     SALOMEDS::TMPFile* 
321     SaveASCII(SALOMEDS::SComponent_ptr theComponent,
322               const char* theURL,
323               bool isMultiFile);
324
325     virtual
326     bool
327     Load(SALOMEDS::SComponent_ptr,
328          const SALOMEDS::TMPFile &,
329          const char* theURL,
330          bool isMultiFile);
331
332     virtual
333     bool
334     LoadASCII(SALOMEDS::SComponent_ptr,
335               const SALOMEDS::TMPFile &,
336               const char* theURL,
337               bool isMultiFile);
338     
339     virtual
340     void
341     Close(SALOMEDS::SComponent_ptr IORSComponent);
342
343     virtual
344     char* 
345     ComponentDataType();
346
347     virtual
348     char* 
349     IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject,
350                            const char* IORString,
351                            CORBA::Boolean isMultiFile,
352                            CORBA::Boolean isASCII);
353
354     virtual
355     char* 
356     LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject,
357                            const char* aLocalPersistentID,
358                            CORBA::Boolean isMultiFile,
359                            CORBA::Boolean isASCII);
360
361     virtual 
362     bool
363     CanPublishInStudy(CORBA::Object_ptr theIOR);
364
365     virtual
366     SALOMEDS::SObject_ptr
367     PublishInStudy(SALOMEDS::Study_ptr theStudy,
368                    SALOMEDS::SObject_ptr theSObject,
369                    CORBA::Object_ptr theObject,
370                    const char* theName) throw (SALOME::SALOME_Exception);
371
372     CORBA::Boolean 
373     CanCopy(SALOMEDS::SObject_ptr theObject);
374
375     SALOMEDS::TMPFile* 
376     CopyFrom(SALOMEDS::SObject_ptr theObject, 
377              CORBA::Long& theObjectID);
378
379     CORBA::Boolean 
380     CanPaste(const char* theComponentName, 
381              CORBA::Long theObjectID);
382
383     SALOMEDS::SObject_ptr
384     PasteInto(const SALOMEDS::TMPFile& theStream,
385               CORBA::Long theObjectID,
386               SALOMEDS::SObject_ptr theObject);
387   };
388 }
389
390 #endif