]> SALOME platform Git repositories - modules/visu.git/blob - src/VISU_I/VISU_Table_i.hh
Salome HOME
5863cf2880b60ff56c557b22c8ac567aff18eb57
[modules/visu.git] / src / VISU_I / VISU_Table_i.hh
1 //  Copyright (C) 2003  CEA/DEN, EDF R&D
2 //
3 //
4 //
5 //  File   : VISU_Table_i.hh
6 //  Author : Vadim SANDLER
7 //  Module : VISU
8
9 #ifndef VISU_Table_i_HeaderFile
10 #define VISU_Table_i_HeaderFile
11
12 #include "VISU_PrsObject_i.hh"
13 #include <qstringlist.h>
14 #include "Plot2d_Curve.h"
15
16 namespace VISU{
17   //==============================================================================
18   class Table_i : public virtual POA_VISU::Table,
19                   public virtual PrsObject_i
20   {
21     static int myNbPresent;
22     Table_i();
23     Table_i( const Table_i& );
24   public:
25     Table_i( SALOMEDS::Study_ptr theStudy, const char* theObject );
26     virtual ~Table_i();
27     virtual VISU::VISUType GetType() { return VISU::TTABLE;};
28
29     virtual void SetTitle( const char* theName ) { SetName( theName ); }
30     virtual char* GetTitle() { return CORBA::string_dup( GetName() ); }
31
32     virtual void SetOrientation( VISU::Table::Orientation theOrientation ) { myOrientation = theOrientation; }
33     virtual VISU::Table::Orientation GetOrientation() { return myOrientation; }
34
35     virtual CORBA::Long GetNbRows();
36     virtual CORBA::Long GetNbColumns();
37
38   protected:
39     Storable* Build(int theRestoring);
40
41   protected:
42     VISU::Table::Orientation myOrientation;
43     string myTitle;
44     string myObjectEntry;
45
46   public:
47     virtual Storable* Create();
48     virtual Storable* Restore( const Storable::TRestoringMap& theMap )
49       throw(std::logic_error&);
50     virtual void ToStream( std::ostringstream& theStr );
51     static const string myComment;
52     virtual const char* GetComment() const;
53     virtual const char* GenerateName();
54     virtual const char* GetTableTitle();
55
56     virtual char* GetObjectEntry() { return CORBA::string_dup( myObjectEntry.c_str() ); }
57   };
58   Storable* TableRestore(SALOMEDS::SObject_ptr theSObject, 
59                          const string& thePrefix, const Storable::TRestoringMap& theMap);
60   SALOMEDS::SObject_var ImportTables(const char* theFileName, SALOMEDS::Study_ptr theStudy);
61
62   //==============================================================================
63   class Curve_i : public virtual POA_VISU::Curve,
64                   public virtual PrsObject_i
65   {
66     static int myNbPresent;
67     Curve_i();
68     Curve_i( const Curve_i& );
69   public:
70     Curve_i( SALOMEDS::Study_ptr theStudy, Table_i* theTable, CORBA::Long theHRow, CORBA::Long theVRow );
71     virtual ~Curve_i();
72     virtual VISU::VISUType GetType() { return VISU::TCURVE;};
73
74     virtual void SetTitle( const char* theName ) { SetName( theName ); }
75     virtual char* GetTitle() { return CORBA::string_dup( GetName() ); }
76
77     virtual void SetColor( const SALOMEDS::Color& theColor ) { myColor = theColor; myAuto = false; }
78     virtual SALOMEDS::Color GetColor() { return myColor; }
79     
80     virtual void SetMarker( VISU::Curve::MarkerType theType ) { myMarker = theType; myAuto = false; }
81     virtual VISU::Curve::MarkerType GetMarker() { return myMarker; }
82
83     virtual void SetLine( VISU::Curve::LineType theType, CORBA::Long theWidth ) 
84                                                 { myLine = theType; myLineWidth = theWidth; myAuto = false; }
85     virtual VISU::Curve::LineType GetLine() { return myLine; }
86     virtual CORBA::Long GetLineWidth() { return myLineWidth; }
87
88   protected:
89     Storable* Build(int theRestoring);
90
91   protected:
92     Table_i*                myTable;
93     int                     myHRow;
94     int                     myVRow;
95     struct SALOMEDS::Color  myColor;
96     VISU::Curve::MarkerType myMarker;
97     VISU::Curve::LineType   myLine;
98     int                     myLineWidth;
99     string                  myTitle;
100     bool                    myAuto;
101
102   public:
103     virtual Storable* Create();
104     virtual Storable* Restore( const Storable::TRestoringMap& theMap )
105       throw(std::logic_error&);
106     virtual void ToStream( std::ostringstream& theStr );
107     static const string myComment;
108     virtual const char* GetComment() const;
109     virtual const char* GenerateName();
110     virtual const char* GetTableID();
111
112     virtual CORBA::Boolean IsAuto() { return myAuto; }
113     virtual CORBA::Boolean IsValid();
114     virtual string GetHorTitle();
115     virtual string GetVerTitle();
116     virtual string GetHorUnits();
117     virtual string GetVerUnits();
118     virtual int    GetData( double*& theHorList, double*& theVerList );
119
120     virtual Plot2d_Curve* CreatePresentation();
121   };
122   Storable* CurveRestore(SALOMEDS::SObject_ptr theSObject, 
123                          const string& thePrefix, const Storable::TRestoringMap& theMap);
124
125   //==============================================================================
126   class Container_i : public virtual POA_VISU::Container,
127                       public virtual PrsObject_i
128   {
129     static int myNbPresent;
130     Container_i();
131     Container_i( const Container_i& );
132   public:
133     Container_i(SALOMEDS::Study_ptr theStudy);
134     virtual ~Container_i();
135     virtual VISU::VISUType GetType() { return VISU::TCONTAINER;};
136
137     virtual void AddCurve( Curve_ptr theCurve );
138     virtual void RemoveCurve( Curve_ptr theCurve );
139
140     virtual CORBA::Long GetNbCurves();
141     virtual void Clear();
142
143   protected:
144     Storable* Build(int theRestoring);
145     
146   protected:
147     QStringList myCurves;
148     
149   public:
150     virtual Storable* Create();
151     virtual Storable* Restore( const Storable::TRestoringMap& theMap )
152       throw(std::logic_error&);
153     virtual void ToStream( std::ostringstream& theStr );
154     static const string myComment;
155     virtual const char* GetComment() const;
156     virtual const char* GenerateName();
157
158     void Update();
159     VISU::Curve_i* GetCurve( CORBA::Long theIndex );
160
161   };
162   Storable* ContainerRestore(SALOMEDS::SObject_ptr theSObject, 
163                              const string& thePrefix, const Storable::TRestoringMap& theMap);
164 }
165 #endif // (#ifndef VISU_Table_i_HeaderFile)
166
167