Salome HOME
Compiler errors on gcc 3.4.1 corrected:
[modules/visu.git] / src / VISU_I / VISU_Table_i.hh
1 //  VISU OBJECT : interactive object for VISU entities implementation
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
5 // 
6 //  This library is free software; you can redistribute it and/or 
7 //  modify it under the terms of the GNU Lesser General Public 
8 //  License as published by the Free Software Foundation; either 
9 //  version 2.1 of the License. 
10 // 
11 //  This library is distributed in the hope that it will be useful, 
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of 
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
14 //  Lesser General Public License for more details. 
15 // 
16 //  You should have received a copy of the GNU Lesser General Public 
17 //  License along with this library; if not, write to the Free Software 
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
19 // 
20 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //  File   : VISU_Table_i.hh
24 //  Author : Vadim SANDLER
25 //  Module : VISU
26
27 #ifndef VISU_Table_i_HeaderFile
28 #define VISU_Table_i_HeaderFile
29
30 #include "VISU_PrsObject_i.hh"
31
32 #include <qstringlist.h>
33
34 class SPlot2d_Curve;
35
36 namespace VISU{
37   //==============================================================================
38   class Table_i : public virtual POA_VISU::Table,
39                   public virtual PrsObject_i
40   {
41     static int myNbPresent;
42     Table_i();
43     Table_i( const Table_i& );
44   public:
45     Table_i( SALOMEDS::Study_ptr theStudy, const char* theObject );
46     virtual ~Table_i();
47     virtual VISU::VISUType GetType() { return VISU::TTABLE;};
48
49     virtual void SetTitle( const char* theName ) { SetName( theName ); }
50     virtual char* GetTitle() { return CORBA::string_dup( GetName() ); }
51
52     virtual void SetOrientation( VISU::Table::Orientation theOrientation ) { myOrientation = theOrientation; }
53     virtual VISU::Table::Orientation GetOrientation() { return myOrientation; }
54
55     virtual CORBA::Long GetNbRows();
56     virtual CORBA::Long GetNbColumns();
57
58     virtual void RemoveFromStudy();
59
60   protected:
61     Storable* Build(int theRestoring);
62
63   protected:
64     VISU::Table::Orientation myOrientation;
65     std::string myTitle;
66     SALOMEDS::SObject_var mySObj;
67
68   public:
69     virtual Storable* Create();
70     SALOMEDS::SObject_var GetSObject() const { return mySObj;}
71
72     virtual Storable* Restore( const Storable::TRestoringMap& theMap, SALOMEDS::SObject_ptr SO);
73     static Storable* Restore(SALOMEDS::SObject_ptr theSObject, 
74                              const std::string& thePrefix, 
75                              const Storable::TRestoringMap& theMap);
76     virtual void ToStream( std::ostringstream& theStr );
77     static const std::string myComment;
78     virtual const char* GetComment() const;
79     virtual const char* GenerateName();
80     virtual const char* GetTableTitle();
81
82     virtual char* GetObjectEntry() { return CORBA::string_dup( mySObj->GetID() ); }
83   };
84   SALOMEDS::SObject_var ImportTables(const char* theFileName, SALOMEDS::Study_ptr theStudy);
85   bool ExportTableToFile(SALOMEDS::SObject_ptr theTable, const char* theFileName);
86   //==============================================================================
87   class Curve_i : public virtual POA_VISU::Curve,
88                   public virtual PrsObject_i
89   {
90     static int myNbPresent;
91     Curve_i();
92     Curve_i( const Curve_i& );
93   public:
94     Curve_i( SALOMEDS::Study_ptr theStudy, Table_i* theTable, CORBA::Long theHRow, CORBA::Long theVRow );
95     virtual ~Curve_i();
96     virtual VISU::VISUType GetType() { return VISU::TCURVE;};
97
98     virtual void SetTitle( const char* theName ) { SetName( theName ); }
99     virtual char* GetTitle() { return CORBA::string_dup( GetName() ); }
100
101     virtual void SetColor( const SALOMEDS::Color& theColor ) { myColor = theColor; myAuto = false; }
102     virtual SALOMEDS::Color GetColor() { return myColor; }
103     
104     virtual void SetMarker( VISU::Curve::MarkerType theType ) { myMarker = theType; myAuto = false; }
105     virtual VISU::Curve::MarkerType GetMarker() { return myMarker; }
106
107     virtual void SetLine( VISU::Curve::LineType theType, CORBA::Long theWidth ) 
108                                                 { myLine = theType; myLineWidth = theWidth; myAuto = false; }
109     virtual VISU::Curve::LineType GetLine() { return myLine; }
110     virtual CORBA::Long GetLineWidth() { return myLineWidth; }
111
112     virtual void RemoveFromStudy();
113
114   protected:
115     Storable* Build(int theRestoring);
116
117   protected:
118     Table_i*                myTable;
119     int                     myHRow;
120     int                     myVRow;
121     struct SALOMEDS::Color  myColor;
122     VISU::Curve::MarkerType myMarker;
123     VISU::Curve::LineType   myLine;
124     int                     myLineWidth;
125     std::string             myTitle;
126     bool                    myAuto;
127     SALOMEDS::SObject_var   mySObj;
128
129   public:
130     virtual Storable* Create();
131
132     int GetHRow() const { return myHRow;}
133     int GetVRow() const { return myVRow;}
134
135     virtual Storable* Restore( const Storable::TRestoringMap& theMap, SALOMEDS::SObject_ptr theSO);
136
137     static Storable* Restore(SALOMEDS::SObject_ptr theSObject, 
138                              const std::string& thePrefix, 
139                              const Storable::TRestoringMap& theMap);
140
141     virtual void ToStream( std::ostringstream& theStr );
142     static const std::string myComment;
143     virtual const char* GetComment() const;
144     virtual const char* GenerateName();
145     virtual const char* GetTableID();
146
147     virtual CORBA::Boolean IsAuto() { return myAuto; }
148     virtual CORBA::Boolean IsValid();
149     virtual std::string GetHorTitle();
150     virtual std::string GetVerTitle();
151     virtual std::string GetHorUnits();
152     virtual std::string GetVerUnits();
153     virtual int    GetData( double*& theHorList, double*& theVerList );
154
155     virtual SPlot2d_Curve* CreatePresentation();
156   };
157
158   //==============================================================================
159   class Container_i : public virtual POA_VISU::Container,
160                       public virtual PrsObject_i
161   {
162     static int myNbPresent;
163     Container_i();
164     Container_i( const Container_i& );
165   public:
166     Container_i(SALOMEDS::Study_ptr theStudy);
167     virtual ~Container_i();
168     virtual VISU::VISUType GetType() { return VISU::TCONTAINER;};
169
170     virtual void AddCurve( Curve_ptr theCurve );
171     virtual void RemoveCurve( Curve_ptr theCurve );
172
173     virtual CORBA::Long GetNbCurves();
174     virtual void Clear();
175
176     virtual void RemoveFromStudy();
177
178   protected:
179     Storable* Build(int theRestoring);
180     
181   protected:
182     QStringList myCurves;
183     SALOMEDS::SObject_var mySObj;
184         
185   public:
186     virtual Storable* Create();
187     virtual Storable* Restore( const Storable::TRestoringMap& theMap, SALOMEDS::SObject_ptr SO );
188
189     static Storable* Restore(SALOMEDS::SObject_ptr theSObject, 
190                              const std::string& thePrefix, 
191                              const Storable::TRestoringMap& theMap);
192
193     virtual void ToStream( std::ostringstream& theStr );
194     static const std::string myComment;
195     virtual const char* GetComment() const;
196     virtual const char* GenerateName();
197
198     void Update();
199     VISU::Curve_i* GetCurve( CORBA::Long theIndex );
200
201   };
202 }
203 #endif
204
205