Back to index

salome-gui  6.5.0
Plot2d_AnalyticalCurve.h
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  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 //  File   : Plot2d_AnalyticalCurve.h
00023 //  Author : Roman NIKOLAEV, Open CASCADE S.A.S. (roman.nikolaev@opencascade.com)
00024 
00025 #ifndef PLOT2D_ANALYTICAL_CURVE_H
00026 #define PLOT2D_ANALYTICAL_CURVE_H
00027 
00028 #include "Plot2d.h"
00029 
00030 
00031 class QwtPlot;
00032 class QwtPlotItem;
00033 
00034 
00035 class PLOT2D_EXPORT Plot2d_AnalyticalCurve
00036 {
00037 public:
00038   
00039   /*
00040     Action enumeration.
00041    */
00042   enum {
00043     ActAddInView = 0,        
00044     ActRemoveFromView,       
00045     ActUpdateInView,         
00046     ActNothing               
00047   };
00048 
00049   /*
00050     State enumeration.
00051    */
00052   enum {
00053     StateOk = 0,
00054     StateNeedUpdate
00055   };
00056   
00057   Plot2d_AnalyticalCurve();
00058   Plot2d_AnalyticalCurve( const Plot2d_AnalyticalCurve& );
00059   Plot2d_AnalyticalCurve& operator= ( const Plot2d_AnalyticalCurve& );
00060 
00061   virtual ~Plot2d_AnalyticalCurve();
00062 
00063   virtual QwtPlotItem* plotItem();
00064   virtual void         autoFill( const QwtPlot* );
00065   virtual void         updatePlotItem();
00066   virtual bool         checkCurve( const QwtPlot* );
00067 
00068   virtual void         calculate();
00069 
00070   long                 getData( double** , double** ) const;
00071 
00072   void                 setSelected(const bool);
00073   bool                 isSelected() const;
00074 
00075 
00076 
00077   void                 setAutoAssign( bool );
00078   bool                 isAutoAssign( ) const;
00079 
00080   void                 setColor( const QColor& );
00081   QColor               getColor() const;
00082 
00083   void                 setMarker( Plot2d::MarkerType );
00084   Plot2d::MarkerType   getMarker() const;
00085 
00086   void                 setMarkerSize( const int );
00087   int                  getMarkerSize() const;
00088 
00089   void                 setLine( Plot2d::LineType );
00090   Plot2d::LineType     getLine() const;
00091 
00092   void                 setLineWidth( const int );
00093   int                  getLineWidth() const;
00094 
00095   void                 setNbIntervals( const long );
00096   long                 getNbIntervals() const;
00097 
00098   void                 setRangeBegin( const double );
00099   double               getRangeBegin() const;
00100 
00101   void                 setRangeEnd( const double );
00102   double               getRangeEnd() const;
00103 
00104   void                 setExpression( const QString& );
00105   QString              getExpression() const;
00106 
00107   void                 setName( const QString& );
00108   QString              getName() const;
00109 
00110   void                 setActive(const bool);
00111   bool                 isActive() const;
00112 
00113   void                 setAction(const int);
00114   int                  getAction() const;
00115   int                  state() const;
00116 
00117 
00118 protected:
00119   
00120   bool                 myAutoAssign;
00121   QColor               myColor;
00122   Plot2d::MarkerType   myMarker;
00123   int                  myMarkerSize;
00124   Plot2d::LineType     myLine;
00125   int                  myLineWidth;
00126   long                 myNbIntervals;
00127   pointList            myPoints;
00128   double               myRangeBegin;
00129   double               myRangeEnd;
00130   QString              myExpression;
00131   QString              myName; 
00132   int                  myAction;
00133   int                  myState;
00134   QwtPlotItem*         myCurve;
00135   bool                 myActive;
00136   bool                 myIsSelected;
00137 
00138 private:
00139   static int           myNbCurves;
00140 
00141 };
00142 
00143 typedef QList<Plot2d_AnalyticalCurve*> AnalyticalCurveList;
00144 
00145 class PLOT2D_EXPORT Plot2d_CurveContainer
00146 {
00147 public:
00148   virtual void              addAnalyticalCurve( Plot2d_AnalyticalCurve* ) = 0;
00149   virtual void              removeAnalyticalCurve( Plot2d_AnalyticalCurve* ) = 0;
00150   virtual void              updateAnalyticalCurve( Plot2d_AnalyticalCurve*, bool = false ) = 0;
00151   virtual void              updateAnalyticalCurves() = 0;
00152   virtual AnalyticalCurveList getAnalyticalCurves() const = 0;
00153 };
00154 
00155 #endif //PLOT2D_ANALYTICAL_CURVE_H
00156