Salome HOME
Update Help for VISU module.
[modules/visu.git] / src / VISU_I / VISU_Table_i.hh
index d92547a727baf557f9be3291190890955cdfef3d..ed911dcfaee60ad70af754ec0ec1ebd3c2244df5 100644 (file)
@@ -1,14 +1,37 @@
-// File:       VISU_Table_i.hh
-// Created:    Thu Feb 13 17:24:49 2003
-// Author:     Vadim SANDLER
-//             <vsr@rolex.nnov.matra-dtv.fr>
+//  VISU OBJECT : interactive object for VISU entities implementation
+//
+//  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
+//
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//  File   : VISU_Table_i.hh
+//  Author : Vadim SANDLER
+//  Module : VISU
 
 #ifndef VISU_Table_i_HeaderFile
 #define VISU_Table_i_HeaderFile
 
 #include "VISU_PrsObject_i.hh"
+
 #include <qstringlist.h>
-#include "Plot2d_Curve.h"
+
+class SPlot2d_Curve;
 
 namespace VISU{
   //==============================================================================
@@ -23,8 +46,8 @@ namespace VISU{
     virtual ~Table_i();
     virtual VISU::VISUType GetType() { return VISU::TTABLE;};
 
-    virtual void SetTitle( const char* theName ) { myTitle = theName; }
-    virtual char* GetTitle() { return CORBA::string_dup( myTitle.c_str() ); }
+    virtual void SetTitle( const char* theName ) { SetName( theName ); }
+    virtual char* GetTitle() { return CORBA::string_dup( GetName() ); }
 
     virtual void SetOrientation( VISU::Table::Orientation theOrientation ) { myOrientation = theOrientation; }
     virtual VISU::Table::Orientation GetOrientation() { return myOrientation; }
@@ -32,29 +55,34 @@ namespace VISU{
     virtual CORBA::Long GetNbRows();
     virtual CORBA::Long GetNbColumns();
 
+    virtual void RemoveFromStudy();
+
   protected:
     Storable* Build(int theRestoring);
 
   protected:
     VISU::Table::Orientation myOrientation;
-    string myTitle;
-    string myObjectEntry;
+    std::string myTitle;
+    SALOMEDS::SObject_var mySObj;
 
   public:
     virtual Storable* Create();
-    virtual Storable* Restore( const Storable::TRestoringMap& theMap )
-      throw(std::logic_error&);
-    virtual void ToStream( ostrstream& theStr );
-    static const string myComment;
+    SALOMEDS::SObject_var GetSObject() const { return mySObj;}
+
+    virtual Storable* Restore( const Storable::TRestoringMap& theMap, SALOMEDS::SObject_ptr SO);
+    static Storable* Restore(SALOMEDS::SObject_ptr theSObject,
+                            const std::string& thePrefix,
+                            const Storable::TRestoringMap& theMap);
+    virtual void ToStream( std::ostringstream& theStr );
+    static const std::string myComment;
     virtual const char* GetComment() const;
     virtual const char* GenerateName();
+    virtual const char* GetTableTitle();
 
-    virtual char* GetObjectEntry() { return CORBA::string_dup( myObjectEntry.c_str() ); }
+    virtual char* GetObjectEntry() { return CORBA::string_dup( mySObj->GetID() ); }
   };
-  Storable* TableRestore(SALOMEDS::SObject_ptr theSObject, 
-                        const string& thePrefix, const Storable::TRestoringMap& theMap);
   SALOMEDS::SObject_var ImportTables(const char* theFileName, SALOMEDS::Study_ptr theStudy);
-
+  bool ExportTableToFile(SALOMEDS::SObject_ptr theTable, const char* theFileName);
   //==============================================================================
   class Curve_i : public virtual POA_VISU::Curve,
                   public virtual PrsObject_i
@@ -67,20 +95,24 @@ namespace VISU{
     virtual ~Curve_i();
     virtual VISU::VISUType GetType() { return VISU::TCURVE;};
 
-    virtual void SetTitle( const char* theName ) { myTitle = theName; myAuto = false; }
-    virtual char* GetTitle() { return CORBA::string_dup( myTitle.c_str() ); }
+    virtual void SetTitle( const char* theName ) { SetName( theName ); }
+    virtual char* GetTitle() { return CORBA::string_dup( GetName() ); }
 
     virtual void SetColor( const SALOMEDS::Color& theColor ) { myColor = theColor; myAuto = false; }
     virtual SALOMEDS::Color GetColor() { return myColor; }
-    
+
     virtual void SetMarker( VISU::Curve::MarkerType theType ) { myMarker = theType; myAuto = false; }
     virtual VISU::Curve::MarkerType GetMarker() { return myMarker; }
 
-    virtual void SetLine( VISU::Curve::LineType theType, CORBA::Long theWidth ) 
+    virtual void SetLine( VISU::Curve::LineType theType, CORBA::Long theWidth )
                                                 { myLine = theType; myLineWidth = theWidth; myAuto = false; }
     virtual VISU::Curve::LineType GetLine() { return myLine; }
     virtual CORBA::Long GetLineWidth() { return myLineWidth; }
 
+    virtual void RemoveFromStudy();
+
+    virtual SALOMEDS::SObject_var GetSObject();
+
   protected:
     Storable* Build(int theRestoring);
 
@@ -92,31 +124,38 @@ namespace VISU{
     VISU::Curve::MarkerType myMarker;
     VISU::Curve::LineType   myLine;
     int                     myLineWidth;
-    string                  myTitle;
+    std::string             myTitle;
     bool                    myAuto;
+    SALOMEDS::SObject_var   mySObj;
 
   public:
     virtual Storable* Create();
-    virtual Storable* Restore( const Storable::TRestoringMap& theMap )
-      throw(std::logic_error&);
-    virtual void ToStream( ostrstream& theStr );
-    static const string myComment;
+
+    int GetHRow() const { return myHRow;}
+    int GetVRow() const { return myVRow;}
+
+    virtual Storable* Restore( const Storable::TRestoringMap& theMap, SALOMEDS::SObject_ptr theSO);
+
+    static Storable* Restore(SALOMEDS::SObject_ptr theSObject,
+                            const std::string& thePrefix,
+                            const Storable::TRestoringMap& theMap);
+
+    virtual void ToStream( std::ostringstream& theStr );
+    static const std::string myComment;
     virtual const char* GetComment() const;
     virtual const char* GenerateName();
     virtual const char* GetTableID();
 
     virtual CORBA::Boolean IsAuto() { return myAuto; }
     virtual CORBA::Boolean IsValid();
-    virtual string GetHorTitle();
-    virtual string GetVerTitle();
-    virtual string GetHorUnits();
-    virtual string GetVerUnits();
+    virtual std::string GetHorTitle();
+    virtual std::string GetVerTitle();
+    virtual std::string GetHorUnits();
+    virtual std::string GetVerUnits();
     virtual int    GetData( double*& theHorList, double*& theVerList );
 
-    virtual Plot2d_Curve* CreatePresentation();
+    virtual SPlot2d_Curve* CreatePresentation();
   };
-  Storable* CurveRestore(SALOMEDS::SObject_ptr theSObject, 
-                        const string& thePrefix, const Storable::TRestoringMap& theMap);
 
   //==============================================================================
   class Container_i : public virtual POA_VISU::Container,
@@ -136,18 +175,25 @@ namespace VISU{
     virtual CORBA::Long GetNbCurves();
     virtual void Clear();
 
+    virtual void RemoveFromStudy();
+
   protected:
     Storable* Build(int theRestoring);
-    
+
   protected:
     QStringList myCurves;
-    
+    SALOMEDS::SObject_var mySObj;
+
   public:
     virtual Storable* Create();
-    virtual Storable* Restore( const Storable::TRestoringMap& theMap )
-      throw(std::logic_error&);
-    virtual void ToStream( ostrstream& theStr );
-    static const string myComment;
+    virtual Storable* Restore( const Storable::TRestoringMap& theMap, SALOMEDS::SObject_ptr SO );
+
+    static Storable* Restore(SALOMEDS::SObject_ptr theSObject,
+                            const std::string& thePrefix,
+                            const Storable::TRestoringMap& theMap);
+
+    virtual void ToStream( std::ostringstream& theStr );
+    static const std::string myComment;
     virtual const char* GetComment() const;
     virtual const char* GenerateName();
 
@@ -155,9 +201,6 @@ namespace VISU{
     VISU::Curve_i* GetCurve( CORBA::Long theIndex );
 
   };
-  Storable* ContainerRestore(SALOMEDS::SObject_ptr theSObject, 
-                            const string& thePrefix, const Storable::TRestoringMap& theMap);
 }
-#endif // (#ifndef VISU_Table_i_HeaderFile)
-
 
+#endif