]> SALOME platform Git repositories - modules/visu.git/blob - src/VISU_I/VISU_Table_i.hh
Salome HOME
4303f6b6ceb3e72712c7efcd46f9b26d3e43c5ea
[modules/visu.git] / src / VISU_I / VISU_Table_i.hh
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  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.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 //  VISU OBJECT : interactive object for VISU entities implementation
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>
33
34 class SPlot2d_Curve;
35
36 namespace VISU{
37   //==============================================================================
38   class VISU_I_EXPORT Table_i : public virtual POA_VISU::Table,
39                   public virtual PrsObject_i
40   {
41     static int myNbPresent;
42     Table_i( const Table_i& );
43   public:
44     Table_i( SALOMEDS::Study_ptr theStudy, const char* theObject );
45     virtual ~Table_i();
46     virtual VISU::VISUType GetType() { return VISU::TTABLE;};
47
48     virtual void SetTitle( const char* theTitle );
49     virtual char* GetTitle();
50
51     virtual void SetOrientation( VISU::Table::Orientation theOrientation );
52     virtual VISU::Table::Orientation GetOrientation();
53
54     virtual CORBA::Long GetNbRows();
55     virtual CORBA::Long GetNbColumns();
56
57     virtual void RemoveFromStudy();
58
59   protected:
60     Storable* Build(int theRestoring);
61
62   protected:
63     VISU::Table::Orientation myOrientation;
64     std::string myTitle;
65     SALOMEDS::SObject_var mySObj;
66
67   public:
68     virtual Storable* Create();
69     SALOMEDS::SObject_var GetSObject() const;
70
71     virtual Storable* Restore( const Storable::TRestoringMap& theMap,
72                                SALOMEDS::SObject_ptr SO);
73
74     static Storable* StorableEngine(SALOMEDS::SObject_ptr theSObject,
75                                     const Storable::TRestoringMap& theMap,
76                                     const std::string& thePrefix,
77                                     CORBA::Boolean theIsMultiFile);
78
79     virtual void ToStream( std::ostringstream& theStr );
80     static const std::string myComment;
81     virtual const char* GetComment() const;
82     virtual QString GenerateName();
83     virtual QString GetTableTitle();
84
85     virtual std::string GetObjectEntry();
86   };
87   SALOMEDS::SObject_var ImportTables(const char* theFileName, SALOMEDS::Study_ptr theStudy);
88   bool ExportTableToFile(SALOMEDS::SObject_ptr theTable, const char* theFileName);
89   //==============================================================================
90   class VISU_I_EXPORT Curve_i : public virtual POA_VISU::Curve,
91                   public virtual PrsObject_i
92   {
93     static int myNbPresent;
94     Curve_i();
95     Curve_i( const Curve_i& );
96   public:
97     Curve_i( SALOMEDS::Study_ptr theStudy, Table_i* theTable,
98              CORBA::Long theHRow, CORBA::Long theVRow, CORBA::Long theZRow );
99     virtual ~Curve_i();
100     virtual VISU::VISUType GetType() { return VISU::TCURVE;};
101
102     virtual void SetTitle( const char* theTitle );
103     virtual char* GetTitle();
104
105     virtual void SetColor( const SALOMEDS::Color& theColor );
106     virtual SALOMEDS::Color GetColor();
107
108     virtual void SetMarker( VISU::Curve::MarkerType theType );
109     virtual VISU::Curve::MarkerType GetMarker();
110
111     virtual void SetLine( VISU::Curve::LineType theType, CORBA::Long theWidth );
112     virtual VISU::Curve::LineType GetLine();
113     virtual CORBA::Long GetLineWidth();
114
115     virtual void RemoveFromStudy();
116
117     virtual SALOMEDS::SObject_var GetSObject();
118
119   protected:
120     Storable* Build(int theRestoring);
121
122   protected:
123     Table_i*                myTable;
124     int                     myHRow;
125     int                     myVRow;
126     int                     myZRow;
127     struct SALOMEDS::Color  myColor;
128     VISU::Curve::MarkerType myMarker;
129     VISU::Curve::LineType   myLine;
130     int                     myLineWidth;
131     std::string             myTitle;
132     bool                    myAuto;
133     SALOMEDS::SObject_var   mySObj;
134
135   public:
136     virtual Storable* Create();
137
138     int GetHRow() const { return myHRow;}
139     int GetVRow() const { return myVRow;}
140     int GetZRow() const { return myZRow;}
141
142     virtual Storable* Restore( const Storable::TRestoringMap& theMap, SALOMEDS::SObject_ptr theSO);
143
144     static Storable* StorableEngine(SALOMEDS::SObject_ptr theSObject,
145                                     const Storable::TRestoringMap& theMap,
146                                     const std::string& thePrefix,
147                                     CORBA::Boolean theIsMultiFile);
148
149     virtual void ToStream( std::ostringstream& theStr );
150     static const std::string myComment;
151     virtual const char* GetComment() const;
152     virtual QString GenerateName();
153     virtual std::string GetTableID();
154
155     virtual CORBA::Boolean IsAuto() { return myAuto; }
156     virtual CORBA::Boolean IsValid();
157     virtual std::string GetHorTitle();
158     virtual std::string GetVerTitle();
159     virtual std::string GetHorUnits();
160     virtual std::string GetVerUnits();
161     virtual int GetData( double*& theHorList, double*& theVerList, QStringList& );
162
163     virtual SPlot2d_Curve* CreatePresentation();
164   };
165
166   //==============================================================================
167   class VISU_I_EXPORT Container_i : public virtual POA_VISU::Container,
168                       public virtual PrsObject_i
169   {
170     static int myNbPresent;
171     Container_i();
172     Container_i( const Container_i& );
173   public:
174     Container_i(SALOMEDS::Study_ptr theStudy);
175     virtual ~Container_i();
176     virtual VISU::VISUType GetType() { return VISU::TCONTAINER;};
177
178     virtual void AddCurve( Curve_ptr theCurve );
179     virtual void RemoveCurve( Curve_ptr theCurve );
180
181     virtual CORBA::Long GetNbCurves();
182     virtual void Clear();
183
184     virtual void RemoveFromStudy();
185
186     virtual SALOMEDS::SObject_var GetSObject();
187
188   protected:
189     Storable* Build(int theRestoring);
190
191   protected:
192     QStringList myCurves;
193     SALOMEDS::SObject_var mySObj;
194
195   public:
196     virtual Storable* Create();
197     virtual Storable* Restore( const Storable::TRestoringMap& theMap, SALOMEDS::SObject_ptr SO );
198
199     static Storable* StorableEngine(SALOMEDS::SObject_ptr theSObject,
200                                     const Storable::TRestoringMap& theMap,
201                                     const std::string& thePrefix,
202                                     CORBA::Boolean theIsMultiFile);
203
204     virtual void ToStream( std::ostringstream& theStr );
205     static const std::string myComment;
206     virtual const char* GetComment() const;
207     virtual QString GenerateName();
208
209     void Update();
210     VISU::Curve_i* GetCurve( CORBA::Long theIndex );
211
212   };
213 }
214
215 #endif