]> SALOME platform Git repositories - modules/visu.git/blob - src/VISU_I/VISU_Gen_i.hh
Salome HOME
Fix pb with Animation
[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   class Result_i;
20   class VISU_Gen_i : public virtual POA_VISU::VISU_Gen,
21                      public virtual ::Engines_Component_i,
22                      public virtual Base_i
23   {
24     SALOMEDS::Study_var myStudyDocument;
25     VISU_Gen_i();
26     VISU_Gen_i(const VISU::VISU_Gen_i &);
27   public:
28     VISU_Gen_i(CORBA::ORB_ptr theORB,
29                PortableServer::POA_ptr thePOA,
30                SALOME_NamingService* theNamingService,
31                QMutex* theMutex);
32     virtual ~VISU_Gen_i();
33
34     virtual char* GetID();
35     virtual VISU::VISUType GetType() { return VISU::TVISUGEN;};
36
37     virtual void SetCurrentStudy(SALOMEDS::Study_ptr theStudy);
38     virtual SALOMEDS::Study_ptr GetCurrentStudy();
39
40     virtual ViewManager_ptr GetViewManager();
41
42     virtual SALOMEDS::SObject_ptr ImportTables(const char* theFileName);
43     virtual CORBA::Boolean ExportTableToFile(SALOMEDS::SObject_ptr theTable, const char* theFileName );
44
45     //Create Result
46     virtual Result_ptr ImportFile(const char* theFileName);
47     virtual Result_ptr CopyAndImportFile(const char* theFileName);
48     virtual Result_ptr ImportMed(SALOMEDS::SObject_ptr theMedSObject);
49     virtual Result_ptr ImportMedField(SALOME_MED::FIELD_ptr theField);
50
51     //Create Presentation Of Submeshes
52     virtual Mesh_ptr MeshOnEntity(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity);
53     virtual Mesh_ptr FamilyMeshOnEntity(Result_ptr theResult, const char* theMeshName,
54                                         VISU::Entity theEntity, const char* theFamilyName);
55     virtual Mesh_ptr GroupMesh(Result_ptr theResult, const char* theMeshName, const char* theGroupName);
56
57     //Create 3D collored Presentation Of Different Types
58     template<typename TPrs3d_i> TPrs3d_i*
59     CreatePrs3d(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity,
60                 const char* theFieldName, CORBA::Double theIteration, bool theAddToStudy = true)
61     {
62       TPrs3d_i* aPresent = NULL;
63       if(myStudyDocument->GetProperties()->IsLocked()) 
64         return aPresent;
65
66       typedef typename TPrs3d_i::TInterface TPrs3d;
67       typename TPrs3d::_var_type aPrs3d;
68       Mutex mt(myMutex);
69       if(Result_i* pResult = dynamic_cast<Result_i*>(GetServant(theResult).in())){
70         if(TPrs3d_i::IsPossible(pResult,theMeshName,theEntity,theFieldName,int(theIteration))){
71           aPresent = new TPrs3d_i(pResult,theAddToStudy);
72           if(aPresent->Create(theMeshName,theEntity,theFieldName,int(theIteration)) == NULL)
73             aPresent->_remove_ref();
74         }
75       }
76       return aPresent;
77     }
78
79     template<typename TPrs3d_i> typename TPrs3d_i::TInterface::_var_type
80     Prs3dOnField(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity,
81                const char* theFieldName, CORBA::Double theIteration, bool theAddToStudy = true)
82     {
83       typedef typename TPrs3d_i::TInterface TPrs3d;
84       typename TPrs3d::_var_type aPrs3d;
85       if(TPrs3d_i* aPrs3d = CreatePrs3d<TPrs3d_i>(theResult,theMeshName,theEntity,theFieldName,theIteration,theAddToStudy))
86         return aPrs3d->_this();
87       return TPrs3d::_nil();
88     }
89
90     virtual ScalarMap_ptr ScalarMapOnField(Result_ptr theResult,
91                                            const char* theMeshName, VISU::Entity theEntity,
92                                            const char* theFieldName, CORBA::Double theIteration);
93     virtual DeformedShape_ptr DeformedShapeOnField(Result_ptr theResult,
94                                                    const char* theMeshName, VISU::Entity theEntity,
95                                                    const char* theFieldName, CORBA::Double theIteration);
96     virtual Vectors_ptr VectorsOnField(Result_ptr theResult,
97                                        const char* theMeshName, VISU::Entity theEntity,
98                                        const char* theFieldName, CORBA::Double theIteration);
99     virtual IsoSurfaces_ptr IsoSurfacesOnField(Result_ptr theResult,
100                                                const char* theMeshName, VISU::Entity theEntity,
101                                                const char* theFieldName, CORBA::Double theIteration);
102     virtual CutPlanes_ptr CutPlanesOnField(Result_ptr theResult,
103                                            const char* theMeshName, VISU::Entity theEntity,
104                                            const char* theFieldName, CORBA::Double theIteration);
105     virtual CutLines_ptr CutLinesOnField(Result_ptr theResult,
106                                          const char* theMeshName, VISU::Entity theEntity,
107                                          const char* theFieldName, CORBA::Double theIteration);
108     virtual StreamLines_ptr StreamLinesOnField(Result_ptr theResult,
109                                                const char* theMeshName, VISU::Entity theEntity,
110                                                const char* theFieldName, CORBA::Double theIteration);
111     virtual Plot3D_ptr Plot3DOnField(Result_ptr theResult,
112                                      const char* theMeshName, VISU::Entity theEntity,
113                                      const char* theFieldName, CORBA::Double theIteration);
114     //Create Digital Presentation
115     virtual Table_ptr CreateTable(const char* theTableEntry);
116     virtual Curve_ptr CreateCurve(Table_ptr theTable, CORBA::Long theHRow, CORBA::Long theVRow);
117     virtual Container_ptr CreateContainer();
118     virtual Animation_ptr CreateAnimation(View3D_ptr theView3d);
119
120     virtual void DeleteResult(Result_ptr theResult);
121     virtual void DeletePrs3d(Prs3d_ptr thePrs3d);
122
123     // inherited methods from Engines::Component
124     virtual
125     Engines::TMPFile*
126     DumpPython(CORBA::Object_ptr theStudy,
127                CORBA::Boolean theIsPublished,
128                CORBA::Boolean& theIsValidScript);
129     // inherited methods from SALOMEDS::Driver
130     virtual SALOMEDS::TMPFile* Save(SALOMEDS::SComponent_ptr theComponent,
131                                     const char* theURL,
132                                     bool isMultiFile);
133     virtual SALOMEDS::TMPFile* SaveASCII(SALOMEDS::SComponent_ptr theComponent,
134                                          const char* theURL,
135                                          bool isMultiFile);
136     virtual bool Load(SALOMEDS::SComponent_ptr,
137                       const SALOMEDS::TMPFile &,
138                       const char* theURL,
139                       bool isMultiFile);
140     virtual bool LoadASCII(SALOMEDS::SComponent_ptr,
141                            const SALOMEDS::TMPFile &,
142                            const char* theURL,
143                            bool isMultiFile);
144
145     virtual void Close(SALOMEDS::SComponent_ptr IORSComponent);
146
147     virtual char* ComponentDataType();
148
149     virtual char* IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject,
150                                          const char* IORString,
151                                          CORBA::Boolean isMultiFile,
152                                          CORBA::Boolean isASCII);
153     virtual char* LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject,
154                                          const char* aLocalPersistentID,
155                                          CORBA::Boolean isMultiFile,
156                                          CORBA::Boolean isASCII);
157
158     virtual bool CanPublishInStudy(CORBA::Object_ptr theIOR);
159     virtual SALOMEDS::SObject_ptr PublishInStudy(SALOMEDS::Study_ptr theStudy,
160                                                  SALOMEDS::SObject_ptr theSObject,
161                                                  CORBA::Object_ptr theObject,
162                                                  const char* theName) throw (SALOME::SALOME_Exception);
163
164     CORBA::Boolean CanCopy(SALOMEDS::SObject_ptr theObject);
165     SALOMEDS::TMPFile* CopyFrom(SALOMEDS::SObject_ptr theObject, CORBA::Long& theObjectID);
166     CORBA::Boolean CanPaste(const char* theComponentName, CORBA::Long theObjectID);
167     SALOMEDS::SObject_ptr PasteInto(const SALOMEDS::TMPFile& theStream,
168                                     CORBA::Long theObjectID,
169                                     SALOMEDS::SObject_ptr theObject);
170   };
171 }
172 #endif