]> SALOME platform Git repositories - modules/visu.git/blob - src/VISU_I/VISU_Gen_i.hh
Salome HOME
70e3833f647b012598dbac0db2a433dfcadeb285
[modules/visu.git] / src / VISU_I / VISU_Gen_i.hh
1 //  Copyright (C) 2007-2010  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& theIsValidScript);
319
320     // inherited methods from SALOMEDS::Driver
321     virtual
322     SALOMEDS::TMPFile* 
323     Save(SALOMEDS::SComponent_ptr theComponent,
324          const char* theURL,
325          bool isMultiFile);
326
327     virtual
328     SALOMEDS::TMPFile* 
329     SaveASCII(SALOMEDS::SComponent_ptr theComponent,
330               const char* theURL,
331               bool isMultiFile);
332
333     virtual
334     bool
335     Load(SALOMEDS::SComponent_ptr,
336          const SALOMEDS::TMPFile &,
337          const char* theURL,
338          bool isMultiFile);
339
340     virtual
341     bool
342     LoadASCII(SALOMEDS::SComponent_ptr,
343               const SALOMEDS::TMPFile &,
344               const char* theURL,
345               bool isMultiFile);
346     
347     virtual
348     void
349     Close(SALOMEDS::SComponent_ptr IORSComponent);
350
351     virtual
352     char* 
353     ComponentDataType();
354
355     virtual
356     char* 
357     IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject,
358                            const char* IORString,
359                            CORBA::Boolean isMultiFile,
360                            CORBA::Boolean isASCII);
361
362     virtual
363     char* 
364     LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject,
365                            const char* aLocalPersistentID,
366                            CORBA::Boolean isMultiFile,
367                            CORBA::Boolean isASCII);
368
369     virtual 
370     bool
371     CanPublishInStudy(CORBA::Object_ptr theIOR);
372
373     virtual
374     SALOMEDS::SObject_ptr
375     PublishInStudy(SALOMEDS::Study_ptr theStudy,
376                    SALOMEDS::SObject_ptr theSObject,
377                    CORBA::Object_ptr theObject,
378                    const char* theName) throw (SALOME::SALOME_Exception);
379
380     CORBA::Boolean 
381     CanCopy(SALOMEDS::SObject_ptr theObject);
382
383     SALOMEDS::TMPFile* 
384     CopyFrom(SALOMEDS::SObject_ptr theObject, 
385              CORBA::Long& theObjectID);
386
387     CORBA::Boolean 
388     CanPaste(const char* theComponentName, 
389              CORBA::Long theObjectID);
390
391     SALOMEDS::SObject_ptr
392     PasteInto(const SALOMEDS::TMPFile& theStream,
393               CORBA::Long theObjectID,
394               SALOMEDS::SObject_ptr theObject);
395
396     virtual
397     VISU::ColoredPrs3dCache_ptr
398     GetColoredPrs3dCache(SALOMEDS::Study_ptr theStudy);
399
400     
401     virtual CORBA::Long CreateClippingPlane(CORBA::Double X,CORBA::Double  Y, CORBA::Double Z, 
402                                             CORBA::Double dX, CORBA::Double dY, CORBA::Double dZ, 
403                                             CORBA::Boolean isAuto, const char* name);
404
405     virtual void EditClippingPlane(CORBA::Long id, CORBA::Double X,CORBA::Double  Y, CORBA::Double Z, 
406                                      CORBA::Double dX, CORBA::Double dY, CORBA::Double dZ, 
407                                      CORBA::Boolean isAuto, const char* name);
408
409     /* Returns clipping plane by its Id */
410     virtual VISU::ClippingPlane* GetClippingPlane(CORBA::Long id);
411     
412     /* Deletes clipping plane by its Id */
413     virtual CORBA::Boolean DeleteClippingPlane(CORBA::Long id);
414     
415     /* Applyes a clipping plane with Id to presentation thePrs */
416     virtual CORBA::Boolean ApplyClippingPlane(Prs3d_ptr thePrs, CORBA::Long id);
417     
418     /* Detaches a clipping plane with Id from presentation thePrs */
419     virtual CORBA::Boolean DetachClippingPlane(Prs3d_ptr thePrs, CORBA::Long id);
420     
421     /* Get number of clipping planes */
422     virtual CORBA::Long GetClippingPlanesNb();
423
424     VISU_ClippingPlaneMgr& GetClippingPlaneMgr() { return myClippingPlaneMgr; }
425
426     /* Convert a set of VTK files to the MED file */
427     virtual
428     CORBA::Boolean
429     VTK2MED(const VISU::string_array& theVTKFiles,
430             const char* theMEDFile,
431             const char* theMeshName,
432             const VISU::double_array& theTStamps);
433
434     /* Load texture from file */
435     virtual CORBA::Long LoadTexture(const char* theTextureFile);
436
437     StudyId2MarkerMap& GetMarkerMap() { return myMarkerMap; }
438   };
439 }
440
441 #endif