Version: 6.3.1

src/VISU_I/VISU_Table_i.hh

Go to the documentation of this file.
00001 // Copyright (C) 2007-2011  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 //  VISU OBJECT : interactive object for VISU entities implementation
00024 //  File   : VISU_Table_i.hh
00025 //  Author : Vadim SANDLER
00026 //  Module : VISU
00027 //
00028 #ifndef VISU_Table_i_HeaderFile
00029 #define VISU_Table_i_HeaderFile
00030 
00031 #include "VISU_PrsObject_i.hh"
00032 
00033 #include <QStringList>
00034 #include <QSet>
00035 
00036 class SPlot2d_Curve;
00037 
00038 namespace VISU{
00039   //==============================================================================
00040   class VISU_I_EXPORT Table_i : public virtual POA_VISU::Table,
00041                   public virtual PrsObject_i
00042   {
00043     static int myNbPresent;
00044     Table_i( const Table_i& );
00045   public:
00046     Table_i( SALOMEDS::Study_ptr theStudy, const char* theObject );
00047     virtual ~Table_i();
00048     virtual VISU::VISUType GetType() { return VISU::TTABLE;};
00049 
00050     virtual void SetTitle( const char* theTitle );
00051     virtual char* GetTitle();
00052 
00053     virtual void SetOrientation( VISU::Table::Orientation theOrientation );
00054     virtual VISU::Table::Orientation GetOrientation();
00055 
00056     virtual CORBA::Long GetNbRows();
00057     virtual CORBA::Long GetNbColumns();
00058 
00059     virtual void SortRow(CORBA::Long theRow, VISU::SortOrder theSortOrder, VISU::SortPolicy theSortPolicy);
00060     virtual void SortColumn(CORBA::Long theColumn, VISU::SortOrder theSortOrder, VISU::SortPolicy theSortPolicy);
00061     virtual void SortByRow(CORBA::Long theRow, VISU::SortOrder theSortOrder, VISU::SortPolicy theSortPolicy);
00062     virtual void SortByColumn(CORBA::Long theColumn, VISU::SortOrder theSortOrder, VISU::SortPolicy theSortPolicy);
00063 
00064     virtual void RemoveFromStudy();
00065 
00066   protected:
00067     Storable* Build(int theRestoring);
00068     void      UpdateCurves(std::map<int, int> theMixData);
00069 
00070   protected:
00071     VISU::Table::Orientation myOrientation;
00072     std::string myTitle;
00073     SALOMEDS::SObject_var mySObj;
00074 
00075   public:
00076     virtual Storable* Create();
00077     SALOMEDS::SObject_var GetSObject() const;
00078 
00079     virtual Storable* Restore( const Storable::TRestoringMap& theMap,
00080                       SALOMEDS::SObject_ptr SO);
00081 
00082     static Storable* StorableEngine(SALOMEDS::SObject_ptr theSObject,
00083                         const Storable::TRestoringMap& theMap,
00084                         const std::string& thePrefix,
00085                         CORBA::Boolean theIsMultiFile);
00086 
00087     virtual void ToStream( std::ostringstream& theStr );
00088     static const std::string myComment;
00089     virtual const char* GetComment() const;
00090     virtual QString GenerateName();
00091     virtual QString GetTableTitle();
00092 
00093     virtual std::string GetObjectEntry();
00094   };
00095   SALOMEDS::SObject_var ImportTables(const char* theFileName, SALOMEDS::Study_ptr theStudy,
00096                                      bool theFirstStrAsTitle = false);
00097   bool ExportTableToFile(SALOMEDS::SObject_ptr theTable, const char* theFileName);
00098   //==============================================================================
00099 
00100   typedef QSet<QString> ContainerSet;
00101 
00102   class VISU_I_EXPORT Curve_i : public virtual POA_VISU::Curve,
00103                   public virtual PrsObject_i
00104   {
00105     static int myNbPresent;
00106     Curve_i();
00107     Curve_i( const Curve_i& );
00108   public:
00109     Curve_i( SALOMEDS::Study_ptr theStudy, Table_i* theTable,
00110           CORBA::Long theHRow, CORBA::Long theVRow, CORBA::Long theZRow,
00111              CORBA::Boolean theIsV2 );
00112     virtual ~Curve_i();
00113     virtual VISU::VISUType GetType() { return VISU::TCURVE;};
00114 
00115     virtual void SetTitle( const char* theTitle );
00116     virtual char* GetTitle();
00117 
00118     virtual void SetColor( const SALOMEDS::Color& theColor );
00119     virtual SALOMEDS::Color GetColor();
00120 
00121     virtual void SetMarker( VISU::Curve::MarkerType theType );
00122     virtual VISU::Curve::MarkerType GetMarker();
00123 
00124     virtual void SetLine( VISU::Curve::LineType theType, CORBA::Long theWidth );
00125     virtual VISU::Curve::LineType GetLine();
00126     virtual CORBA::Long GetLineWidth();
00127 
00128     virtual void addContainer(const QString& id);
00129     virtual void removeContainer(const QString& id);
00130     virtual ContainerSet getContainers() const;
00131 
00132     virtual void RemoveFromStudy();
00133 
00134     virtual SALOMEDS::SObject_var GetSObject();
00135 
00136   protected:
00137     Storable* Build(int theRestoring);
00138 
00139   protected:
00140     Table_i*                myTable;
00141     int                     myHRow;
00142     int                     myVRow;
00143     int                     myZRow;
00144     bool                    myIsV2;
00145     struct SALOMEDS::Color  myColor;
00146     VISU::Curve::MarkerType myMarker;
00147     VISU::Curve::LineType   myLine;
00148     int                     myLineWidth;
00149     std::string             myTitle;
00150     bool                    myAuto;
00151     SALOMEDS::SObject_var   mySObj;
00152     ContainerSet            myContainers;
00153 
00154   public:
00155     virtual Storable* Create();
00156     
00157     Table_i* getTable() const {return myTable;}
00158 
00159     int  GetHRow() const { return myHRow; }
00160     void SetHRow( const int theHRow ) { myHRow = theHRow; }
00161 
00162     int  GetVRow() const { return myVRow; }
00163     void SetVRow( const int theVRow ) { myVRow = theVRow; }
00164 
00165     int  GetZRow() const { return myZRow; }
00166     void SetZRow( const int theZRow ) { myZRow = theZRow; }
00167 
00168     int  GetIsV2() const { return myIsV2; }
00169     void SetIsV2( const int theIsV2 ) { myIsV2 = theIsV2; }
00170 
00171     virtual Storable* Restore( const Storable::TRestoringMap& theMap, SALOMEDS::SObject_ptr theSO);
00172 
00173     static Storable* StorableEngine(SALOMEDS::SObject_ptr theSObject,
00174                         const Storable::TRestoringMap& theMap,
00175                         const std::string& thePrefix,
00176                         CORBA::Boolean theIsMultiFile);
00177 
00178     virtual void ToStream( std::ostringstream& theStr );
00179     static const std::string myComment;
00180     virtual const char* GetComment() const;
00181     virtual QString GenerateName();
00182     virtual std::string GetTableID();
00183 
00184     virtual CORBA::Boolean IsAuto() { return myAuto; }
00185     virtual CORBA::Boolean IsValid();
00186     virtual std::string GetHorTitle();
00187     virtual std::string GetVerTitle();
00188     virtual std::string GetHorUnits();
00189     virtual std::string GetVerUnits();
00190     virtual int GetData( double*& theHorList, double*& theVerList, QStringList& );
00191 
00192     virtual SPlot2d_Curve* CreatePresentation();
00193   };
00194 
00195   //==============================================================================
00196   class VISU_I_EXPORT Container_i : public virtual POA_VISU::Container,
00197                       public virtual PrsObject_i
00198   {
00199     static int myNbPresent;
00200     Container_i();
00201     Container_i( const Container_i& );
00202   public:
00203     Container_i(SALOMEDS::Study_ptr theStudy);
00204     virtual ~Container_i();
00205     virtual VISU::VISUType GetType() { return VISU::TCONTAINER;};
00206 
00207     virtual void AddCurve( Curve_ptr theCurve );
00208     virtual void RemoveCurve( Curve_ptr theCurve );
00209 
00210     virtual CORBA::Long GetNbCurves();
00211     virtual void Clear();
00212 
00213     virtual void RemoveFromStudy();
00214 
00215     virtual SALOMEDS::SObject_var GetSObject();
00216 
00217   protected:
00218     Storable* Build(int theRestoring);
00219 
00220   protected:
00221     QStringList myCurves;
00222     SALOMEDS::SObject_var mySObj;
00223 
00224   public:
00225     virtual Storable* Create();
00226     virtual Storable* Restore( const Storable::TRestoringMap& theMap, SALOMEDS::SObject_ptr SO );
00227 
00228     static Storable* StorableEngine(SALOMEDS::SObject_ptr theSObject,
00229                         const Storable::TRestoringMap& theMap,
00230                         const std::string& thePrefix,
00231                         CORBA::Boolean theIsMultiFile);
00232 
00233     virtual void ToStream( std::ostringstream& theStr );
00234     static const std::string myComment;
00235     virtual const char* GetComment() const;
00236     virtual QString GenerateName();
00237 
00238     void Update();
00239     VISU::Curve_i* GetCurve( CORBA::Long theIndex );
00240 
00241   };
00242 }
00243 
00244 #endif
Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS