]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
To provide a way to introduce a new type of 3D presentation without IDL modification
authorapo <apo@opencascade.com>
Wed, 17 Aug 2005 05:51:12 +0000 (05:51 +0000)
committerapo <apo@opencascade.com>
Wed, 17 Aug 2005 05:51:12 +0000 (05:51 +0000)
src/VISU_I/VISU_Gen_i.hh

index a624db6f075975349cd6b1e655f699044442491a..abaac0a6e46e0d1dc3a7f46fd8e3d022e4211a6e 100644 (file)
@@ -55,23 +55,35 @@ namespace VISU{
     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();
        }
       }
+      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();
     }