Salome HOME
NRI : merge from 1.2c
[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     VISU_Gen_var myVisuGen;
25     SALOMEDS::Study_var myStudyDocument;
26     VISU_Gen_i();
27     VISU_Gen_i(const VISU::VISU_Gen_i &);
28   public:
29     VISU_Gen_i(CORBA::ORB_ptr theORB, PortableServer::POA_ptr thePOA, 
30                SALOME_NamingService* theNamingService, QMutex* theMutex);
31     VISU_Gen_i(CORBA::ORB_ptr orb,
32                PortableServer::POA_ptr poa,
33                PortableServer::ObjectId * contId, 
34                const char *instanceName, 
35                const char *interfaceName);
36     virtual ~VISU_Gen_i();
37
38     virtual char* GetID();
39     virtual VISU::VISUType GetType() { return VISU::TVISUGEN;};
40
41     virtual void SetCurrentStudy(SALOMEDS::Study_ptr theStudy);
42     virtual SALOMEDS::Study_ptr GetCurrentStudy();
43
44     virtual ViewManager_ptr GetViewManager();
45
46     virtual SALOMEDS::SObject_ptr ImportTables(const char* theFileName);
47
48     //Create Result
49     virtual Result_ptr ImportFile(const char* theFileName);
50     virtual Result_ptr ImportMed(SALOMEDS::SObject_ptr theMedSObject);
51     virtual Result_ptr ImportMedField(SALOME_MED::FIELD_ptr theField);
52
53     //Create Presentation Of Submeshes
54     virtual Mesh_ptr MeshOnEntity(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity);
55     virtual Mesh_ptr FamilyMeshOnEntity(Result_ptr theResult, const char* theMeshName, 
56                                         VISU::Entity theEntity, const char* theFamilyName);
57     virtual Mesh_ptr GroupMesh(Result_ptr theResult, const char* theMeshName, const char* theGroupName);
58
59     //Create 3D collored Presentation Of Different Types
60     template<typename TPrs3d_i> typename TPrs3d_i::TInterface::_ptr_type 
61     Prs3dOnField(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity, 
62                const char* theFieldName, CORBA::Double theIteration)
63     {
64       typedef typename TPrs3d_i::TInterface TPrs3d;
65       if(myStudyDocument->GetProperties()->IsLocked()) return TPrs3d::_nil();
66       Mutex mt(myMutex,qApp);
67       Result_i* pResult = dynamic_cast<Result_i*>(GetServant(theResult));
68       if(TPrs3d_i::IsPossible(pResult,theMeshName,theEntity,theFieldName,int(theIteration))){
69         TPrs3d_i* aPresent = new TPrs3d_i(pResult);
70         if(aPresent->Create(theMeshName,theEntity,theFieldName,int(theIteration)) != NULL){
71           return aPresent->_this();
72         }
73       }
74       return TPrs3d::_nil();
75     }
76
77     virtual ScalarMap_ptr ScalarMapOnField(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity, 
78                                            const char* theFieldName, CORBA::Double theIteration);
79     virtual DeformedShape_ptr DeformedShapeOnField(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity, 
80                                                    const char* theFieldName, CORBA::Double theIteration);
81     virtual Vectors_ptr VectorsOnField(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity, 
82                                        const char* theFieldName, CORBA::Double theIteration);
83     virtual IsoSurfaces_ptr IsoSurfacesOnField(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity, 
84                                                const char* theFieldName, CORBA::Double theIteration);
85     virtual CutPlanes_ptr CutPlanesOnField(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity, 
86                                            const char* theFieldName, CORBA::Double theIteration);
87     virtual CutLines_ptr CutLinesOnField(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity, 
88                                          const char* theFieldName, CORBA::Double theIteration);
89     virtual StreamLines_ptr StreamLinesOnField(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity, 
90                                                const char* theFieldName, CORBA::Double theIteration);
91     //Create Digital Presentation
92     virtual Table_ptr CreateTable(const char* theTableEntry);
93     virtual Curve_ptr CreateCurve(Table_ptr theTable, CORBA::Long theHRow, CORBA::Long theVRow);
94     virtual Container_ptr CreateContainer();
95     virtual Animation_ptr CreateAnimation(View3D_ptr theView3d);
96     
97     // inherited methods from SALOMEDS::Driver
98     virtual SALOMEDS::TMPFile* Save(SALOMEDS::SComponent_ptr theComponent,
99                                     const char* theURL,
100                                     bool isMultiFile);
101     virtual SALOMEDS::TMPFile* SaveASCII(SALOMEDS::SComponent_ptr theComponent,
102                                          const char* theURL,
103                                          bool isMultiFile);
104     virtual bool Load(SALOMEDS::SComponent_ptr,
105                       const SALOMEDS::TMPFile &,
106                       const char* theURL,
107                       bool isMultiFile);
108     virtual bool LoadASCII(SALOMEDS::SComponent_ptr,
109                            const SALOMEDS::TMPFile &,
110                            const char* theURL,
111                            bool isMultiFile);
112
113     virtual void Close(SALOMEDS::SComponent_ptr IORSComponent); 
114
115     virtual char* ComponentDataType();
116
117     virtual char* IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject,
118                                          const char* IORString,
119                                          CORBA::Boolean isMultiFile,
120                                          CORBA::Boolean isASCII);
121     virtual char* LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject,
122                                          const char* aLocalPersistentID,
123                                          CORBA::Boolean isMultiFile,
124                                          CORBA::Boolean isASCII);
125     
126     virtual bool CanPublishInStudy(CORBA::Object_ptr theIOR);
127     virtual SALOMEDS::SObject_ptr PublishInStudy(SALOMEDS::Study_ptr theStudy,
128                                                  SALOMEDS::SObject_ptr theSObject,
129                                                  CORBA::Object_ptr theObject,
130                                                  const char* theName) throw (SALOME::SALOME_Exception);
131
132     CORBA::Boolean CanCopy(SALOMEDS::SObject_ptr theObject);
133     SALOMEDS::TMPFile* CopyFrom(SALOMEDS::SObject_ptr theObject, CORBA::Long& theObjectID);
134     CORBA::Boolean CanPaste(const char* theComponentName, CORBA::Long theObjectID);
135     SALOMEDS::SObject_ptr PasteInto(const SALOMEDS::TMPFile& theStream,
136                                     CORBA::Long theObjectID,
137                                     SALOMEDS::SObject_ptr theObject);
138   };
139 }
140 #endif