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