Salome HOME
0021478: EDF 2083 ALL: Write the version of Salome used to create the study in the...
[modules/visu.git] / src / VISU_I / VISU_Gen_i.hh
index 1a90cd8e2b660a2fc063f644419156077433b6b5..5d3f39d72f5db336dbb6b4b40ba95f99cbc13dcd 100644 (file)
@@ -1,61 +1,69 @@
-//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
-// 
-//  This library is free software; you can redistribute it and/or 
-//  modify it under the terms of the GNU Lesser General Public 
-//  License as published by the Free Software Foundation; either 
-//  version 2.1 of the License. 
-// 
-//  This library is distributed in the hope that it will be useful, 
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
-//  Lesser General Public License for more details. 
-// 
-//  You should have received a copy of the GNU Lesser General Public 
-//  License along with this library; if not, write to the Free Software 
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
-// 
+// Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+
 //  File   : VISU_Gen_i.hh
 //  Author : Alexey Petrov
 //  Module : VISU
-
+//
 #ifndef __VISU_GEN_I_H__
 #define __VISU_GEN_I_H__
 
 #include "VISUConfig.hh"
 
+#include "VISU_I.hxx"
 #include "SALOME_Component_i.hxx"
 #include "SALOME_NamingService.hxx"
+#include "VISU_ColoredPrs3d_i.hh"
+#include "VISU_ClippingPlaneMgr.hxx"
+
+#include <VTKViewer_MarkerDef.h>
 
+#include <map>
 #include <string>
 
 namespace VISU
 {
-  class Result_i;
-  class ColoredPrs3d_i;
-
-  bool
-  CreatColoredPrs3d(ColoredPrs3d_i* theColoredPrs3d,
-                   const char* theMeshName, 
-                   VISU::Entity theEntity,
-                   const char* theFieldName, 
-                   CORBA::Double theIteration);
+  //----------------------------------------------------------------------------
+  typedef std::map<int, VTK::MarkerMap> StudyId2MarkerMap;
 
+  //----------------------------------------------------------------------------
   class VISU_Gen_i : public virtual POA_VISU::VISU_Gen,
                     public virtual ::Engines_Component_i,
                     public virtual Base_i
   {
     SALOMEDS::Study_var myStudyDocument;
-    VISU_Gen_i();
+    VISU_ClippingPlaneMgr myClippingPlaneMgr;
+
+    StudyId2MarkerMap myMarkerMap;
+
     VISU_Gen_i(const VISU::VISU_Gen_i &);
   public:
     VISU_Gen_i(CORBA::ORB_ptr theORB,
               PortableServer::POA_ptr thePOA,
               SALOME_NamingService* theNamingService,
               QMutex* theMutex);
-    virtual ~VISU_Gen_i();
+
+    virtual 
+    ~VISU_Gen_i();
 
     virtual 
     char* 
@@ -79,7 +87,7 @@ namespace VISU
 
     virtual
     SALOMEDS::SObject_ptr
-    ImportTables(const char* theFileName);
+    ImportTables(const char* theFileName, bool theFirstStrAsTitle = false);
 
     virtual
     CORBA::Boolean
@@ -87,7 +95,7 @@ namespace VISU
                      const char* theFileName );
 
     //Create Result
-    virtual 
+    virtual
     Result_ptr
     ImportFile(const char* theFileName);
 
@@ -110,11 +118,11 @@ namespace VISU
 
     //Rename Presentation Of Submeshes
     void
-    RenameMeshInStudy(Result_ptr  theResult,
-                     std::string theMeshName,
-                     int         theEntity,      // -1 for group indication
-                     std::string theSubMeshName, // Family or Group name
-                     std::string theNewName);
+    RenameMeshInStudy(Result_ptr theResult,
+                     const std::string& theMeshName,
+                     int theEntity, // -1 for group indication
+                     const std::string& theSubMeshName, // Family or Group name
+                     const std::string& theNewName);
     virtual
     void
     RenameEntityInStudy(Result_ptr   theResult,
@@ -131,7 +139,7 @@ namespace VISU
     virtual
     void
     RenameGroupInStudy(Result_ptr  theResult,
-                      const char* theMeshName,
+                      const char*  theMeshName,
                       const char* theGroupName,
                       const char* theNewName);
 
@@ -155,46 +163,9 @@ namespace VISU
              const char* theMeshName, 
              const char* theGroupName);
 
-    //Create 3D collored Presentation Of Different Types
-    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)
-    {
-      if(myStudyDocument->GetProperties()->IsLocked()) 
-       return NULL;
-
-      typedef typename TPrs3d_i::TInterface TPrs3d;
-      typename TPrs3d::_var_type aPrs3d;
-      Mutex mt(myMutex);
-      if(Result_i* aResult = dynamic_cast<Result_i*>(GetServant(theResult).in())){
-       if(TPrs3d_i::IsPossible(aResult,theMeshName,theEntity,theFieldName,int(theIteration))){
-         TPrs3d_i* aPresent = new TPrs3d_i(aResult,theAddToStudy);
-         if(CreatColoredPrs3d(aPresent,theMeshName,theEntity,theFieldName,theIteration))
-           return aPresent;
-         aPresent->_remove_ref();
-       }
-      }
-      return NULL;
-    }
-
-    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();
-    }
+    Prs3d_ptr
+    CreatePrs3d(VISUType theType,
+               SALOMEDS::Study_ptr theStudy);
 
     virtual
     ScalarMap_ptr
@@ -202,7 +173,7 @@ namespace VISU
                     const char* theMeshName, 
                     VISU::Entity theEntity,
                     const char* theFieldName, 
-                    CORBA::Double theIteration);
+                    CORBA::Long theIteration);
 
     virtual
     GaussPoints_ptr
@@ -210,7 +181,7 @@ namespace VISU
                       const char* theMeshName, 
                       VISU::Entity theEntity,
                       const char* theFieldName, 
-                      CORBA::Double theIteration);
+                      CORBA::Long theIteration);
 
     virtual
     DeformedShape_ptr
@@ -218,22 +189,32 @@ namespace VISU
                         const char* theMeshName, 
                         VISU::Entity theEntity,
                         const char* theFieldName, 
-                        CORBA::Double theIteration);
+                        CORBA::Long theIteration);
 
+    //This function is obsolete. Use DeformedShapeAndScalarMapOnField instead.
     virtual
-    ScalarMapOnDeformedShape_ptr
+    DeformedShapeAndScalarMap_ptr
     ScalarMapOnDeformedShapeOnField(Result_ptr theResult,
                                    const char* theMeshName, 
                                    VISU::Entity theEntity,
                                    const char* theFieldName, 
-                                   CORBA::Double theIteration);
+                                   CORBA::Long theIteration);
+
+    virtual
+    DeformedShapeAndScalarMap_ptr
+    DeformedShapeAndScalarMapOnField(Result_ptr theResult,
+                                    const char* theMeshName, 
+                                    VISU::Entity theEntity,
+                                    const char* theFieldName, 
+                                    CORBA::Long theIteration);
+
     virtual
     Vectors_ptr
     VectorsOnField(Result_ptr theResult,
                   const char* theMeshName, 
                   VISU::Entity theEntity,
                   const char* theFieldName, 
-                  CORBA::Double theIteration);
+                  CORBA::Long theIteration);
 
     virtual
     IsoSurfaces_ptr
@@ -241,7 +222,7 @@ namespace VISU
                       const char* theMeshName, 
                       VISU::Entity theEntity,
                       const char* theFieldName, 
-                      CORBA::Double theIteration);
+                      CORBA::Long theIteration);
 
     virtual
     CutPlanes_ptr
@@ -249,7 +230,7 @@ namespace VISU
                     const char* theMeshName, 
                     VISU::Entity theEntity,
                     const char* theFieldName, 
-                    CORBA::Double theIteration);
+                    CORBA::Long theIteration);
 
     virtual
     CutLines_ptr
@@ -257,7 +238,15 @@ namespace VISU
                    const char* theMeshName, 
                    VISU::Entity theEntity,
                    const char* theFieldName, 
-                   CORBA::Double theIteration);
+                   CORBA::Long theIteration);
+
+    virtual
+    CutSegment_ptr
+    CutSegmentOnField(Result_ptr theResult,
+                     const char* theMeshName, 
+                     VISU::Entity theEntity,
+                     const char* theFieldName, 
+                     CORBA::Long theIteration);
 
     virtual
     StreamLines_ptr
@@ -265,7 +254,7 @@ namespace VISU
                       const char* theMeshName, 
                       VISU::Entity theEntity,
                       const char* theFieldName, 
-                      CORBA::Double theIteration);
+                      CORBA::Long theIteration);
 
     virtual
     Plot3D_ptr
@@ -273,7 +262,7 @@ namespace VISU
                  const char* theMeshName, 
                  VISU::Entity theEntity,
                  const char* theFieldName, 
-                 CORBA::Double theIteration);
+                 CORBA::Long theIteration);
 
     //Create Digital Presentation
     virtual 
@@ -286,6 +275,21 @@ namespace VISU
                CORBA::Long theHRow, 
                CORBA::Long theVRow);
 
+    virtual
+    Curve_ptr
+    CreateCurveWithZ(Table_ptr theTable, 
+                     CORBA::Long theHRow, 
+                     CORBA::Long theVRow,
+                     CORBA::Long theZRow);
+
+    virtual
+    Curve_ptr
+    CreateCurveWithZExt(Table_ptr theTable, 
+                        CORBA::Long theHRow, 
+                        CORBA::Long theVRow,
+                        CORBA::Long theZRow,
+                        CORBA::Boolean theIsV2);
+
     virtual
     Container_ptr 
     CreateContainer();
@@ -294,6 +298,10 @@ namespace VISU
     Animation_ptr
     CreateAnimation(View3D_ptr theView3d);
 
+    virtual
+    Evolution_ptr
+    CreateEvolution(XYPlot_ptr theXYPLot);
+
     virtual
     void 
     DeleteResult(Result_ptr theResult);
@@ -307,6 +315,7 @@ namespace VISU
     Engines::TMPFile*
     DumpPython(CORBA::Object_ptr theStudy,
               CORBA::Boolean theIsPublished,
+              CORBA::Boolean theIsMultiFile,
               CORBA::Boolean& theIsValidScript);
 
     // inherited methods from SALOMEDS::Driver
@@ -384,6 +393,52 @@ namespace VISU
     PasteInto(const SALOMEDS::TMPFile& theStream,
              CORBA::Long theObjectID,
              SALOMEDS::SObject_ptr theObject);
+
+
+    char* getVersion();
+
+    virtual
+    VISU::ColoredPrs3dCache_ptr
+    GetColoredPrs3dCache(SALOMEDS::Study_ptr theStudy);
+
+    
+    virtual CORBA::Long CreateClippingPlane(CORBA::Double X,CORBA::Double  Y, CORBA::Double Z, 
+                                           CORBA::Double dX, CORBA::Double dY, CORBA::Double dZ, 
+                                           CORBA::Boolean isAuto, const char* name);
+
+    virtual void EditClippingPlane(CORBA::Long id, CORBA::Double X,CORBA::Double  Y, CORBA::Double Z, 
+                                    CORBA::Double dX, CORBA::Double dY, CORBA::Double dZ, 
+                                    CORBA::Boolean isAuto, const char* name);
+
+    /* Returns clipping plane by its Id */
+    virtual VISU::ClippingPlane* GetClippingPlane(CORBA::Long id);
+    
+    /* Deletes clipping plane by its Id */
+    virtual CORBA::Boolean DeleteClippingPlane(CORBA::Long id);
+    
+    /* Applyes a clipping plane with Id to presentation thePrs */
+    virtual CORBA::Boolean ApplyClippingPlane(Prs3d_ptr thePrs, CORBA::Long id);
+    
+    /* Detaches a clipping plane with Id from presentation thePrs */
+    virtual CORBA::Boolean DetachClippingPlane(Prs3d_ptr thePrs, CORBA::Long id);
+    
+    /* Get number of clipping planes */
+    virtual CORBA::Long GetClippingPlanesNb();
+
+    VISU_ClippingPlaneMgr& GetClippingPlaneMgr() { return myClippingPlaneMgr; }
+
+    /* Convert a set of VTK files to the MED file */
+    virtual
+    CORBA::Boolean
+    VTK2MED(const VISU::string_array& theVTKFiles,
+           const char* theMEDFile,
+           const char* theMeshName,
+           const VISU::double_array& theTStamps);
+
+    /* Load texture from file */
+    virtual CORBA::Long LoadTexture(const char* theTextureFile);
+
+    StudyId2MarkerMap& GetMarkerMap() { return myMarkerMap; }
   };
 }