]> SALOME platform Git repositories - modules/visu.git/blob - src/VISU_I/VISU_Table_i.hh
Salome HOME
Merge from V6_2_BR 23/12/2010
[modules/visu.git] / src / VISU_I / VISU_Table_i.hh
1 //  Copyright (C) 2007-2010  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
23 //  VISU OBJECT : interactive object for VISU entities implementation
24 //  File   : VISU_Table_i.hh
25 //  Author : Vadim SANDLER
26 //  Module : VISU
27 //
28 #ifndef VISU_Table_i_HeaderFile
29 #define VISU_Table_i_HeaderFile
30
31 #include "VISU_PrsObject_i.hh"
32
33 #include <QStringList>
34
35 class SPlot2d_Curve;
36
37 namespace VISU{
38   //==============================================================================
39   class VISU_I_EXPORT Table_i : public virtual POA_VISU::Table,
40                   public virtual PrsObject_i
41   {
42     static int myNbPresent;
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* theTitle );
50     virtual char* GetTitle();
51
52     virtual void SetOrientation( VISU::Table::Orientation theOrientation );
53     virtual VISU::Table::Orientation GetOrientation();
54
55     virtual CORBA::Long GetNbRows();
56     virtual CORBA::Long GetNbColumns();
57
58     virtual void SortRow(CORBA::Long theRow, VISU::SortOrder theSortOrder, VISU::SortPolicy theSortPolicy);
59     virtual void SortColumn(CORBA::Long theColumn, VISU::SortOrder theSortOrder, VISU::SortPolicy theSortPolicy);
60     virtual void SortByRow(CORBA::Long theRow, VISU::SortOrder theSortOrder, VISU::SortPolicy theSortPolicy);
61     virtual void SortByColumn(CORBA::Long theColumn, VISU::SortOrder theSortOrder, VISU::SortPolicy theSortPolicy);
62
63     virtual void RemoveFromStudy();
64
65   protected:
66     Storable* Build(int theRestoring);
67     void      UpdateCurves(std::map<int, int> theMixData);
68
69   protected:
70     VISU::Table::Orientation myOrientation;
71     std::string myTitle;
72     SALOMEDS::SObject_var mySObj;
73
74   public:
75     virtual Storable* Create();
76     SALOMEDS::SObject_var GetSObject() const;
77
78     virtual Storable* Restore( const Storable::TRestoringMap& theMap,
79                                SALOMEDS::SObject_ptr SO);
80
81     static Storable* StorableEngine(SALOMEDS::SObject_ptr theSObject,
82                                     const Storable::TRestoringMap& theMap,
83                                     const std::string& thePrefix,
84                                     CORBA::Boolean theIsMultiFile);
85
86     virtual void ToStream( std::ostringstream& theStr );
87     static const std::string myComment;
88     virtual const char* GetComment() const;
89     virtual QString GenerateName();
90     virtual QString GetTableTitle();
91
92     virtual std::string GetObjectEntry();
93   };
94   SALOMEDS::SObject_var ImportTables(const char* theFileName, SALOMEDS::Study_ptr theStudy,
95                                      bool theFirstStrAsTitle = false);
96   bool ExportTableToFile(SALOMEDS::SObject_ptr theTable, const char* theFileName);
97   //==============================================================================
98   class VISU_I_EXPORT Curve_i : public virtual POA_VISU::Curve,
99                   public virtual PrsObject_i
100   {
101     static int myNbPresent;
102     Curve_i();
103     Curve_i( const Curve_i& );
104   public:
105     Curve_i( SALOMEDS::Study_ptr theStudy, Table_i* theTable,
106              CORBA::Long theHRow, CORBA::Long theVRow, CORBA::Long theZRow,
107              CORBA::Boolean theIsV2 );
108     virtual ~Curve_i();
109     virtual VISU::VISUType GetType() { return VISU::TCURVE;};
110
111     virtual void SetTitle( const char* theTitle );
112     virtual char* GetTitle();
113
114     virtual void SetColor( const SALOMEDS::Color& theColor );
115     virtual SALOMEDS::Color GetColor();
116
117     virtual void SetMarker( VISU::Curve::MarkerType theType );
118     virtual VISU::Curve::MarkerType GetMarker();
119
120     virtual void SetLine( VISU::Curve::LineType theType, CORBA::Long theWidth );
121     virtual VISU::Curve::LineType GetLine();
122     virtual CORBA::Long GetLineWidth();
123
124     virtual void RemoveFromStudy();
125
126     virtual SALOMEDS::SObject_var GetSObject();
127
128   protected:
129     Storable* Build(int theRestoring);
130
131   protected:
132     Table_i*                myTable;
133     int                     myHRow;
134     int                     myVRow;
135     int                     myZRow;
136     bool                    myIsV2;
137     struct SALOMEDS::Color  myColor;
138     VISU::Curve::MarkerType myMarker;
139     VISU::Curve::LineType   myLine;
140     int                     myLineWidth;
141     std::string             myTitle;
142     bool                    myAuto;
143     SALOMEDS::SObject_var   mySObj;
144
145   public:
146     virtual Storable* Create();
147
148     int  GetHRow() const { return myHRow; }
149     void SetHRow( const int theHRow ) { myHRow = theHRow; }
150
151     int  GetVRow() const { return myVRow; }
152     void SetVRow( const int theVRow ) { myVRow = theVRow; }
153
154     int  GetZRow() const { return myZRow; }
155     void SetZRow( const int theZRow ) { myZRow = theZRow; }
156
157     int  GetIsV2() const { return myIsV2; }
158     void SetIsV2( const int theIsV2 ) { myIsV2 = theIsV2; }
159
160     virtual Storable* Restore( const Storable::TRestoringMap& theMap, SALOMEDS::SObject_ptr theSO);
161
162     static Storable* StorableEngine(SALOMEDS::SObject_ptr theSObject,
163                                     const Storable::TRestoringMap& theMap,
164                                     const std::string& thePrefix,
165                                     CORBA::Boolean theIsMultiFile);
166
167     virtual void ToStream( std::ostringstream& theStr );
168     static const std::string myComment;
169     virtual const char* GetComment() const;
170     virtual QString GenerateName();
171     virtual std::string GetTableID();
172
173     virtual CORBA::Boolean IsAuto() { return myAuto; }
174     virtual CORBA::Boolean IsValid();
175     virtual std::string GetHorTitle();
176     virtual std::string GetVerTitle();
177     virtual std::string GetHorUnits();
178     virtual std::string GetVerUnits();
179     virtual int GetData( double*& theHorList, double*& theVerList, QStringList& );
180
181     virtual SPlot2d_Curve* CreatePresentation();
182   };
183
184   //==============================================================================
185   class VISU_I_EXPORT Container_i : public virtual POA_VISU::Container,
186                       public virtual PrsObject_i
187   {
188     static int myNbPresent;
189     Container_i();
190     Container_i( const Container_i& );
191   public:
192     Container_i(SALOMEDS::Study_ptr theStudy);
193     virtual ~Container_i();
194     virtual VISU::VISUType GetType() { return VISU::TCONTAINER;};
195
196     virtual void AddCurve( Curve_ptr theCurve );
197     virtual void RemoveCurve( Curve_ptr theCurve );
198
199     virtual CORBA::Long GetNbCurves();
200     virtual void Clear();
201
202     virtual void RemoveFromStudy();
203
204     virtual SALOMEDS::SObject_var GetSObject();
205
206   protected:
207     Storable* Build(int theRestoring);
208
209   protected:
210     QStringList myCurves;
211     SALOMEDS::SObject_var mySObj;
212
213   public:
214     virtual Storable* Create();
215     virtual Storable* Restore( const Storable::TRestoringMap& theMap, SALOMEDS::SObject_ptr SO );
216
217     static Storable* StorableEngine(SALOMEDS::SObject_ptr theSObject,
218                                     const Storable::TRestoringMap& theMap,
219                                     const std::string& thePrefix,
220                                     CORBA::Boolean theIsMultiFile);
221
222     virtual void ToStream( std::ostringstream& theStr );
223     static const std::string myComment;
224     virtual const char* GetComment() const;
225     virtual QString GenerateName();
226
227     void Update();
228     VISU::Curve_i* GetCurve( CORBA::Long theIndex );
229
230   };
231 }
232
233 #endif