1 // Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // VISU OBJECT : interactive object for VISU entities implementation
24 // File : VISU_Table_i.hh
25 // Author : Vadim SANDLER
28 #ifndef VISU_Table_i_HeaderFile
29 #define VISU_Table_i_HeaderFile
31 #include "VISU_PrsObject_i.hh"
33 #include <QStringList>
39 //==============================================================================
40 class VISU_I_EXPORT Table_i : public virtual POA_VISU::Table,
41 public virtual PrsObject_i
43 static int myNbPresent;
44 Table_i( const Table_i& );
46 Table_i( SALOMEDS::Study_ptr theStudy, const char* theObject );
48 virtual VISU::VISUType GetType() { return VISU::TTABLE;};
50 virtual void SetTitle( const char* theTitle );
51 virtual char* GetTitle();
53 virtual void SetOrientation( VISU::Table::Orientation theOrientation );
54 virtual VISU::Table::Orientation GetOrientation();
56 virtual CORBA::Long GetNbRows();
57 virtual CORBA::Long GetNbColumns();
59 virtual void SortRow(CORBA::Long theRow, VISU::SortOrder theSortOrder, VISU::SortPolicy theSortPolicy);
60 virtual void SortColumn(CORBA::Long theColumn, VISU::SortOrder theSortOrder, VISU::SortPolicy theSortPolicy);
61 virtual void SortByRow(CORBA::Long theRow, VISU::SortOrder theSortOrder, VISU::SortPolicy theSortPolicy);
62 virtual void SortByColumn(CORBA::Long theColumn, VISU::SortOrder theSortOrder, VISU::SortPolicy theSortPolicy);
64 virtual void RemoveFromStudy();
67 Storable* Build(int theRestoring);
68 void UpdateCurves(std::map<int, int> theMixData);
71 VISU::Table::Orientation myOrientation;
73 SALOMEDS::SObject_var mySObj;
76 virtual Storable* Create();
77 SALOMEDS::SObject_var GetSObject() const;
79 virtual Storable* Restore( const Storable::TRestoringMap& theMap,
80 SALOMEDS::SObject_ptr SO);
82 static Storable* StorableEngine(SALOMEDS::SObject_ptr theSObject,
83 const Storable::TRestoringMap& theMap,
84 const std::string& thePrefix,
85 CORBA::Boolean theIsMultiFile);
87 virtual void ToStream( std::ostringstream& theStr );
88 static const std::string myComment;
89 virtual const char* GetComment() const;
90 virtual QString GenerateName();
91 virtual QString GetTableTitle();
93 virtual std::string GetObjectEntry();
95 SALOMEDS::SObject_var ImportTables(const char* theFileName, SALOMEDS::Study_ptr theStudy,
96 bool theFirstStrAsTitle = false);
97 bool ExportTableToFile(SALOMEDS::SObject_ptr theTable, const char* theFileName);
98 //==============================================================================
100 typedef QSet<QString> ContainerSet;
102 class VISU_I_EXPORT Curve_i : public virtual POA_VISU::Curve,
103 public virtual PrsObject_i
105 static int myNbPresent;
107 Curve_i( const Curve_i& );
109 Curve_i( SALOMEDS::Study_ptr theStudy, Table_i* theTable,
110 CORBA::Long theHRow, CORBA::Long theVRow, CORBA::Long theZRow,
111 CORBA::Boolean theIsV2 );
113 virtual VISU::VISUType GetType() { return VISU::TCURVE;};
115 virtual void SetTitle( const char* theTitle );
116 virtual char* GetTitle();
118 virtual void SetColor( const SALOMEDS::Color& theColor );
119 virtual SALOMEDS::Color GetColor();
121 virtual void SetMarker( VISU::Curve::MarkerType theType );
122 virtual VISU::Curve::MarkerType GetMarker();
124 virtual void SetLine( VISU::Curve::LineType theType, CORBA::Long theWidth );
125 virtual VISU::Curve::LineType GetLine();
126 virtual CORBA::Long GetLineWidth();
128 virtual void addContainer(const QString& id);
129 virtual void removeContainer(const QString& id);
130 virtual ContainerSet getContainers() const;
132 virtual void RemoveFromStudy();
134 virtual SALOMEDS::SObject_var GetSObject();
137 Storable* Build(int theRestoring);
145 struct SALOMEDS::Color myColor;
146 VISU::Curve::MarkerType myMarker;
147 VISU::Curve::LineType myLine;
151 SALOMEDS::SObject_var mySObj;
152 ContainerSet myContainers;
155 virtual Storable* Create();
157 Table_i* getTable() const {return myTable;}
159 int GetHRow() const { return myHRow; }
160 void SetHRow( const int theHRow ) { myHRow = theHRow; }
162 int GetVRow() const { return myVRow; }
163 void SetVRow( const int theVRow ) { myVRow = theVRow; }
165 int GetZRow() const { return myZRow; }
166 void SetZRow( const int theZRow ) { myZRow = theZRow; }
168 int GetIsV2() const { return myIsV2; }
169 void SetIsV2( const int theIsV2 ) { myIsV2 = theIsV2; }
171 virtual Storable* Restore( const Storable::TRestoringMap& theMap, SALOMEDS::SObject_ptr theSO);
173 static Storable* StorableEngine(SALOMEDS::SObject_ptr theSObject,
174 const Storable::TRestoringMap& theMap,
175 const std::string& thePrefix,
176 CORBA::Boolean theIsMultiFile);
178 virtual void ToStream( std::ostringstream& theStr );
179 static const std::string myComment;
180 virtual const char* GetComment() const;
181 virtual QString GenerateName();
182 virtual std::string GetTableID();
184 virtual CORBA::Boolean IsAuto() { return myAuto; }
185 virtual CORBA::Boolean IsValid();
186 virtual std::string GetHorTitle();
187 virtual std::string GetVerTitle();
188 virtual std::string GetHorUnits();
189 virtual std::string GetVerUnits();
190 virtual int GetData( double*& theHorList, double*& theVerList, QStringList& );
192 virtual SPlot2d_Curve* CreatePresentation();
195 //==============================================================================
196 class VISU_I_EXPORT Container_i : public virtual POA_VISU::Container,
197 public virtual PrsObject_i
199 static int myNbPresent;
201 Container_i( const Container_i& );
203 Container_i(SALOMEDS::Study_ptr theStudy);
204 virtual ~Container_i();
205 virtual VISU::VISUType GetType() { return VISU::TCONTAINER;};
207 virtual void AddCurve( Curve_ptr theCurve );
208 virtual void RemoveCurve( Curve_ptr theCurve );
210 virtual CORBA::Long GetNbCurves();
211 virtual void Clear();
213 virtual void RemoveFromStudy();
215 virtual SALOMEDS::SObject_var GetSObject();
218 Storable* Build(int theRestoring);
221 QStringList myCurves;
222 SALOMEDS::SObject_var mySObj;
225 virtual Storable* Create();
226 virtual Storable* Restore( const Storable::TRestoringMap& theMap, SALOMEDS::SObject_ptr SO );
228 static Storable* StorableEngine(SALOMEDS::SObject_ptr theSObject,
229 const Storable::TRestoringMap& theMap,
230 const std::string& thePrefix,
231 CORBA::Boolean theIsMultiFile);
233 virtual void ToStream( std::ostringstream& theStr );
234 static const std::string myComment;
235 virtual const char* GetComment() const;
236 virtual QString GenerateName();
239 VISU::Curve_i* GetCurve( CORBA::Long theIndex );