Salome HOME
Update Help for VISU module.
[modules/visu.git] / src / VISU_I / VISU_Gen_i.hh
index 3b212add81aa9c2d7f5d789842b7939669faa476..240b6beacb6be67d682c8fe464156e8515defccf 100644 (file)
@@ -5,7 +5,7 @@
 //  File   : VISU_GEN_i.h file
 //  Author : Alexey Petrov
 //  Module : VISU
-//  $Header: 
+//  $Header:
 
 #ifndef __VISU_GEN_I_H__
 #define __VISU_GEN_I_H__
@@ -25,9 +25,9 @@ namespace VISU{
     VISU_Gen_i();
     VISU_Gen_i(const VISU::VISU_Gen_i &);
   public:
-    VISU_Gen_i(CORBA::ORB_ptr theORB, 
-              PortableServer::POA_ptr thePOA, 
-              SALOME_NamingService* theNamingService, 
+    VISU_Gen_i(CORBA::ORB_ptr theORB,
+              PortableServer::POA_ptr thePOA,
+              SALOME_NamingService* theNamingService,
               QMutex* theMutex);
     virtual ~VISU_Gen_i();
 
@@ -50,57 +50,81 @@ namespace VISU{
 
     //Create Presentation Of Submeshes
     virtual Mesh_ptr MeshOnEntity(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity);
-    virtual Mesh_ptr FamilyMeshOnEntity(Result_ptr theResult, const char* theMeshName, 
+    virtual Mesh_ptr FamilyMeshOnEntity(Result_ptr theResult, const char* theMeshName,
                                        VISU::Entity theEntity, const char* theFamilyName);
     virtual Mesh_ptr GroupMesh(Result_ptr theResult, const char* theMeshName, const char* theGroupName);
 
     //Create 3D collored Presentation Of Different Types
-    template<typename TPrs3d_i> typename TPrs3d_i::TInterface::_var_type 
-    Prs3dOnField(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity, 
-              const char* theFieldName, CORBA::Double theIteration, bool theAddToStudy = true)
+    template<typename TPrs3d_i> TPrs3d_i*
+    CreatePrs3d(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity,
+               const char* theFieldName, CORBA::Double theIteration, bool theAddToStudy = true)
     {
+      TPrs3d_i* aPresent = NULL;
+      if(myStudyDocument->GetProperties()->IsLocked()) 
+       return aPresent;
+
       typedef typename TPrs3d_i::TInterface TPrs3d;
       typename TPrs3d::_var_type aPrs3d;
-      if(myStudyDocument->GetProperties()->IsLocked()) return TPrs3d::_nil();
       Mutex mt(myMutex);
       if(Result_i* pResult = dynamic_cast<Result_i*>(GetServant(theResult).in())){
        if(TPrs3d_i::IsPossible(pResult,theMeshName,theEntity,theFieldName,int(theIteration))){
-         TPrs3d_i* aPresent = new TPrs3d_i(pResult,theAddToStudy);
-         if(aPresent->Create(theMeshName,theEntity,theFieldName,int(theIteration)) != NULL)
-           return aPresent->_this();
-         else
+         aPresent = new TPrs3d_i(pResult,theAddToStudy);
+         if(aPresent->Create(theMeshName,theEntity,theFieldName,int(theIteration)) == NULL){
            aPresent->_remove_ref();
+           aPresent = NULL;
+         }
        }
       }
+      return aPresent;
+    }
+
+    template<typename TPrs3d_i> typename TPrs3d_i::TInterface::_var_type
+    Prs3dOnField(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity,
+              const char* theFieldName, CORBA::Double theIteration, bool theAddToStudy = true)
+    {
+      typedef typename TPrs3d_i::TInterface TPrs3d;
+      typename TPrs3d::_var_type aPrs3d;
+      if(TPrs3d_i* aPrs3d = CreatePrs3d<TPrs3d_i>(theResult,theMeshName,theEntity,theFieldName,theIteration,theAddToStudy))
+       return aPrs3d->_this();
       return TPrs3d::_nil();
     }
 
-    virtual ScalarMap_ptr ScalarMapOnField(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity, 
+    virtual ScalarMap_ptr ScalarMapOnField(Result_ptr theResult,
+                                          const char* theMeshName, VISU::Entity theEntity,
                                           const char* theFieldName, CORBA::Double theIteration);
-    virtual DeformedShape_ptr DeformedShapeOnField(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity, 
+    virtual DeformedShape_ptr DeformedShapeOnField(Result_ptr theResult,
+                                                  const char* theMeshName, VISU::Entity theEntity,
                                                   const char* theFieldName, CORBA::Double theIteration);
-    virtual Vectors_ptr VectorsOnField(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity, 
+    virtual Vectors_ptr VectorsOnField(Result_ptr theResult,
+                                      const char* theMeshName, VISU::Entity theEntity,
                                       const char* theFieldName, CORBA::Double theIteration);
-    virtual IsoSurfaces_ptr IsoSurfacesOnField(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity, 
+    virtual IsoSurfaces_ptr IsoSurfacesOnField(Result_ptr theResult,
+                                              const char* theMeshName, VISU::Entity theEntity,
                                               const char* theFieldName, CORBA::Double theIteration);
-    virtual CutPlanes_ptr CutPlanesOnField(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity, 
+    virtual CutPlanes_ptr CutPlanesOnField(Result_ptr theResult,
+                                          const char* theMeshName, VISU::Entity theEntity,
                                           const char* theFieldName, CORBA::Double theIteration);
-    virtual CutLines_ptr CutLinesOnField(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity, 
+    virtual CutLines_ptr CutLinesOnField(Result_ptr theResult,
+                                        const char* theMeshName, VISU::Entity theEntity,
                                         const char* theFieldName, CORBA::Double theIteration);
-    virtual StreamLines_ptr StreamLinesOnField(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity, 
+    virtual StreamLines_ptr StreamLinesOnField(Result_ptr theResult,
+                                              const char* theMeshName, VISU::Entity theEntity,
                                               const char* theFieldName, CORBA::Double theIteration);
+    virtual Plot3D_ptr Plot3DOnField(Result_ptr theResult,
+                                    const char* theMeshName, VISU::Entity theEntity,
+                                    const char* theFieldName, CORBA::Double theIteration);
     //Create Digital Presentation
     virtual Table_ptr CreateTable(const char* theTableEntry);
     virtual Curve_ptr CreateCurve(Table_ptr theTable, CORBA::Long theHRow, CORBA::Long theVRow);
     virtual Container_ptr CreateContainer();
     virtual Animation_ptr CreateAnimation(View3D_ptr theView3d);
-    
-    virtual void DeleteResult(Result_ptr theResult) {} // apo
-    virtual void DeletePrs3d(Prs3d_ptr thePrs3d) {} // apo
+
+    virtual void DeleteResult(Result_ptr theResult);
+    virtual void DeletePrs3d(Prs3d_ptr thePrs3d);
 
     // inherited methods from Engines::Component
-    virtual 
-    Engines::TMPFile* 
+    virtual
+    Engines::TMPFile*
     DumpPython(CORBA::Object_ptr theStudy,
               CORBA::Boolean theIsPublished,
               CORBA::Boolean& theIsValidScript);
@@ -120,7 +144,7 @@ namespace VISU{
                           const char* theURL,
                           bool isMultiFile);
 
-    virtual void Close(SALOMEDS::SComponent_ptr IORSComponent); 
+    virtual void Close(SALOMEDS::SComponent_ptr IORSComponent);
 
     virtual char* ComponentDataType();
 
@@ -132,7 +156,7 @@ namespace VISU{
                                         const char* aLocalPersistentID,
                                         CORBA::Boolean isMultiFile,
                                         CORBA::Boolean isASCII);
-    
+
     virtual bool CanPublishInStudy(CORBA::Object_ptr theIOR);
     virtual SALOMEDS::SObject_ptr PublishInStudy(SALOMEDS::Study_ptr theStudy,
                                                 SALOMEDS::SObject_ptr theSObject,
@@ -147,4 +171,4 @@ namespace VISU{
                                    SALOMEDS::SObject_ptr theObject);
   };
 }
-#endif 
+#endif