Salome HOME
32eec815397bb2a4119dd0bd7eb361887f4326cb
[modules/visu.git] / src / VISU_I / VISU_Gen_i.hh
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  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.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 //  File   : VISU_Gen_i.hh
23 //  Author : Alexey Petrov
24 //  Module : VISU
25 //
26 #ifndef __VISU_GEN_I_H__
27 #define __VISU_GEN_I_H__
28
29 #include "VISUConfig.hh"
30
31 #include "VISU_I.hxx"
32 #include "SALOME_Component_i.hxx"
33 #include "SALOME_NamingService.hxx"
34 #include "VISU_ColoredPrs3d_i.hh"
35 #include "VISU_ClippingPlaneMgr.hxx"
36
37 #include <string>
38
39 namespace VISU
40 {
41   //----------------------------------------------------------------------------
42   class VISU_Gen_i : public virtual POA_VISU::VISU_Gen,
43                      public virtual ::Engines_Component_i,
44                      public virtual Base_i
45   {
46     SALOMEDS::Study_var myStudyDocument;
47     VISU_ClippingPlaneMgr myClippingPlaneMgr;
48
49     VISU_Gen_i(const VISU::VISU_Gen_i &);
50   public:
51     VISU_Gen_i(CORBA::ORB_ptr theORB,
52                PortableServer::POA_ptr thePOA,
53                SALOME_NamingService* theNamingService,
54                QMutex* theMutex);
55
56     virtual 
57     ~VISU_Gen_i();
58
59     virtual 
60     char* 
61     GetID();
62
63     virtual
64     VISU::VISUType 
65     GetType() { return VISU::TVISUGEN;};
66
67     virtual
68     void
69     SetCurrentStudy(SALOMEDS::Study_ptr theStudy);
70
71     virtual
72     SALOMEDS::Study_ptr
73     GetCurrentStudy();
74
75     virtual
76     ViewManager_ptr
77     GetViewManager();
78
79     virtual
80     SALOMEDS::SObject_ptr
81     ImportTables(const char* theFileName);
82
83     virtual
84     CORBA::Boolean
85     ExportTableToFile(SALOMEDS::SObject_ptr theTable, 
86                       const char* theFileName );
87
88     //Create Result
89     virtual
90     Result_ptr
91     ImportFile(const char* theFileName);
92
93     virtual
94     Result_ptr
95     CreateResult(const char* theFileName);
96
97     virtual
98     Result_ptr
99     CopyAndImportFile(const char* theFileName);
100
101     virtual
102     Result_ptr
103     ImportMed(SALOMEDS::SObject_ptr theMedSObject);
104
105     virtual
106     Result_ptr
107     ImportMedField(SALOME_MED::FIELD_ptr theField);
108
109
110     //Rename Presentation Of Submeshes
111     void
112     RenameMeshInStudy(Result_ptr theResult,
113                       const std::string& theMeshName,
114                       int theEntity, // -1 for group indication
115                       const std::string& theSubMeshName, // Family or Group name
116                       const std::string& theNewName);
117     virtual
118     void
119     RenameEntityInStudy(Result_ptr   theResult,
120                         const char*  theMeshName,
121                         VISU::Entity theEntity,
122                         const char*  theNewName);
123     virtual
124     void
125     RenameFamilyInStudy(Result_ptr   theResult,
126                         const char*  theMeshName,
127                         VISU::Entity theEntity,
128                         const char*  theFamilyName,
129                         const char*  theNewName);
130     virtual
131     void
132     RenameGroupInStudy(Result_ptr  theResult,
133                        const char*  theMeshName,
134                        const char* theGroupName,
135                        const char* theNewName);
136
137     //Create Presentation Of Submeshes
138     virtual
139     Mesh_ptr
140     MeshOnEntity(Result_ptr theResult, 
141                  const char* theMeshName, 
142                  VISU::Entity theEntity);
143
144     virtual
145     Mesh_ptr
146     FamilyMeshOnEntity(Result_ptr theResult, 
147                        const char* theMeshName,
148                        VISU::Entity theEntity, 
149                        const char* theFamilyName);
150
151     virtual
152     Mesh_ptr
153     GroupMesh(Result_ptr theResult, 
154               const char* theMeshName, 
155               const char* theGroupName);
156
157     Prs3d_ptr
158     CreatePrs3d(VISUType theType,
159                 SALOMEDS::Study_ptr theStudy);
160
161     virtual
162     ScalarMap_ptr
163     ScalarMapOnField(Result_ptr theResult,
164                      const char* theMeshName, 
165                      VISU::Entity theEntity,
166                      const char* theFieldName, 
167                      CORBA::Long theIteration);
168
169     virtual
170     GaussPoints_ptr
171     GaussPointsOnField(Result_ptr theResult,
172                        const char* theMeshName, 
173                        VISU::Entity theEntity,
174                        const char* theFieldName, 
175                        CORBA::Long theIteration);
176
177     virtual
178     DeformedShape_ptr
179     DeformedShapeOnField(Result_ptr theResult,
180                          const char* theMeshName, 
181                          VISU::Entity theEntity,
182                          const char* theFieldName, 
183                          CORBA::Long theIteration);
184
185     //This function is obsolete. Use DeformedShapeAndScalarMapOnField instead.
186     virtual
187     DeformedShapeAndScalarMap_ptr
188     ScalarMapOnDeformedShapeOnField(Result_ptr theResult,
189                                     const char* theMeshName, 
190                                     VISU::Entity theEntity,
191                                     const char* theFieldName, 
192                                     CORBA::Long theIteration);
193
194     virtual
195     DeformedShapeAndScalarMap_ptr
196     DeformedShapeAndScalarMapOnField(Result_ptr theResult,
197                                      const char* theMeshName, 
198                                      VISU::Entity theEntity,
199                                      const char* theFieldName, 
200                                      CORBA::Long theIteration);
201
202     virtual
203     Vectors_ptr
204     VectorsOnField(Result_ptr theResult,
205                    const char* theMeshName, 
206                    VISU::Entity theEntity,
207                    const char* theFieldName, 
208                    CORBA::Long theIteration);
209
210     virtual
211     IsoSurfaces_ptr
212     IsoSurfacesOnField(Result_ptr theResult,
213                        const char* theMeshName, 
214                        VISU::Entity theEntity,
215                        const char* theFieldName, 
216                        CORBA::Long theIteration);
217
218     virtual
219     CutPlanes_ptr
220     CutPlanesOnField(Result_ptr theResult,
221                      const char* theMeshName, 
222                      VISU::Entity theEntity,
223                      const char* theFieldName, 
224                      CORBA::Long theIteration);
225
226     virtual
227     CutLines_ptr
228     CutLinesOnField(Result_ptr theResult,
229                     const char* theMeshName, 
230                     VISU::Entity theEntity,
231                     const char* theFieldName, 
232                     CORBA::Long theIteration);
233
234     virtual
235     CutSegment_ptr
236     CutSegmentOnField(Result_ptr theResult,
237                       const char* theMeshName, 
238                       VISU::Entity theEntity,
239                       const char* theFieldName, 
240                       CORBA::Long theIteration);
241
242     virtual
243     StreamLines_ptr
244     StreamLinesOnField(Result_ptr theResult,
245                        const char* theMeshName, 
246                        VISU::Entity theEntity,
247                        const char* theFieldName, 
248                        CORBA::Long theIteration);
249
250     virtual
251     Plot3D_ptr
252     Plot3DOnField(Result_ptr theResult,
253                   const char* theMeshName, 
254                   VISU::Entity theEntity,
255                   const char* theFieldName, 
256                   CORBA::Long theIteration);
257
258     //Create Digital Presentation
259     virtual 
260     Table_ptr
261     CreateTable(const char* theTableEntry);
262
263     virtual
264     Curve_ptr
265     CreateCurve(Table_ptr theTable, 
266                 CORBA::Long theHRow, 
267                 CORBA::Long theVRow);
268     virtual
269     Curve_ptr
270     CreateCurveWithZ(Table_ptr theTable, 
271                 CORBA::Long theHRow, 
272                 CORBA::Long theVRow,
273                 CORBA::Long theZRow);
274
275     virtual
276     Container_ptr 
277     CreateContainer();
278
279     virtual
280     Animation_ptr
281     CreateAnimation(View3D_ptr theView3d);
282
283     virtual
284     Evolution_ptr
285     CreateEvolution(XYPlot_ptr theXYPLot);
286
287     virtual
288     void 
289     DeleteResult(Result_ptr theResult);
290
291     virtual
292     void 
293     DeletePrs3d(Prs3d_ptr thePrs3d);
294
295     // inherited methods from Engines::Component
296     virtual
297     Engines::TMPFile*
298     DumpPython(CORBA::Object_ptr theStudy,
299                CORBA::Boolean theIsPublished,
300                CORBA::Boolean& theIsValidScript);
301
302     // inherited methods from SALOMEDS::Driver
303     virtual
304     SALOMEDS::TMPFile* 
305     Save(SALOMEDS::SComponent_ptr theComponent,
306          const char* theURL,
307          bool isMultiFile);
308
309     virtual
310     SALOMEDS::TMPFile* 
311     SaveASCII(SALOMEDS::SComponent_ptr theComponent,
312               const char* theURL,
313               bool isMultiFile);
314
315     virtual
316     bool
317     Load(SALOMEDS::SComponent_ptr,
318          const SALOMEDS::TMPFile &,
319          const char* theURL,
320          bool isMultiFile);
321
322     virtual
323     bool
324     LoadASCII(SALOMEDS::SComponent_ptr,
325               const SALOMEDS::TMPFile &,
326               const char* theURL,
327               bool isMultiFile);
328     
329     virtual
330     void
331     Close(SALOMEDS::SComponent_ptr IORSComponent);
332
333     virtual
334     char* 
335     ComponentDataType();
336
337     virtual
338     char* 
339     IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject,
340                            const char* IORString,
341                            CORBA::Boolean isMultiFile,
342                            CORBA::Boolean isASCII);
343
344     virtual
345     char* 
346     LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject,
347                            const char* aLocalPersistentID,
348                            CORBA::Boolean isMultiFile,
349                            CORBA::Boolean isASCII);
350
351     virtual 
352     bool
353     CanPublishInStudy(CORBA::Object_ptr theIOR);
354
355     virtual
356     SALOMEDS::SObject_ptr
357     PublishInStudy(SALOMEDS::Study_ptr theStudy,
358                    SALOMEDS::SObject_ptr theSObject,
359                    CORBA::Object_ptr theObject,
360                    const char* theName) throw (SALOME::SALOME_Exception);
361
362     CORBA::Boolean 
363     CanCopy(SALOMEDS::SObject_ptr theObject);
364
365     SALOMEDS::TMPFile* 
366     CopyFrom(SALOMEDS::SObject_ptr theObject, 
367              CORBA::Long& theObjectID);
368
369     CORBA::Boolean 
370     CanPaste(const char* theComponentName, 
371              CORBA::Long theObjectID);
372
373     SALOMEDS::SObject_ptr
374     PasteInto(const SALOMEDS::TMPFile& theStream,
375               CORBA::Long theObjectID,
376               SALOMEDS::SObject_ptr theObject);
377
378     virtual
379     VISU::ColoredPrs3dCache_ptr
380     GetColoredPrs3dCache(SALOMEDS::Study_ptr theStudy);
381
382     
383     virtual CORBA::Long CreateClippingPlane(CORBA::Double X,CORBA::Double  Y, CORBA::Double Z, 
384                                             CORBA::Double dX, CORBA::Double dY, CORBA::Double dZ, 
385                                             CORBA::Boolean isAuto, const char* name);
386
387     virtual void EditClippingPlane(CORBA::Long id, CORBA::Double X,CORBA::Double  Y, CORBA::Double Z, 
388                                      CORBA::Double dX, CORBA::Double dY, CORBA::Double dZ, 
389                                      CORBA::Boolean isAuto, const char* name);
390
391     /* Returns clipping plane by its Id */
392     virtual VISU::ClippingPlane* GetClippingPlane(CORBA::Long id);
393     
394     /* Deletes clipping plane by its Id */
395     virtual CORBA::Boolean DeleteClippingPlane(CORBA::Long id);
396     
397     /* Applyes a clipping plane with Id to presentation thePrs */
398     virtual CORBA::Boolean ApplyClippingPlane(Prs3d_ptr thePrs, CORBA::Long id);
399     
400     /* Detaches a clipping plane with Id from presentation thePrs */
401     virtual CORBA::Boolean DetachClippingPlane(Prs3d_ptr thePrs, CORBA::Long id);
402     
403     /* Get number of clipping planes */
404     virtual CORBA::Long GetClippingPlanesNb();
405
406     VISU_ClippingPlaneMgr& GetClippingPlaneMgr() { return myClippingPlaneMgr; }
407
408     /* Convert a set of VTK files to the MED file */
409     virtual
410     CORBA::Boolean
411     VTK2MED(const VISU::string_array& theVTKFiles,
412             const char* theMEDFile,
413             const char* theMeshName,
414             const VISU::double_array& theTStamps);
415
416   };
417 }
418
419 #endif