Salome HOME
Update copyrights 2014.
[modules/gui.git] / src / Plot2d / Plot2d_AnalyticalCurve.h
1 // Copyright (C) 2007-2014  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, or (at your option) any later version.
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 //  File   : Plot2d_AnalyticalCurve.h
23 //  Author : Roman NIKOLAEV, Open CASCADE S.A.S. (roman.nikolaev@opencascade.com)
24
25 #ifndef PLOT2D_ANALYTICAL_CURVE_H
26 #define PLOT2D_ANALYTICAL_CURVE_H
27
28 #include "Plot2d.h"
29
30
31 class QwtPlot;
32 class QwtPlotItem;
33
34
35 class PLOT2D_EXPORT Plot2d_AnalyticalCurve
36 {
37 public:
38   
39   /*
40     Action enumeration.
41    */
42   enum {
43     ActAddInView = 0,        //! Add curve in view
44     ActRemoveFromView,       //! Remove curve from view
45     ActUpdateInView,         //! Update curve in view 
46     ActNothing               //! Do nothing
47   };
48
49   /*
50     State enumeration.
51    */
52   enum {
53     StateOk = 0,
54     StateNeedUpdate
55   };
56   
57   Plot2d_AnalyticalCurve();
58   Plot2d_AnalyticalCurve( const Plot2d_AnalyticalCurve& );
59   Plot2d_AnalyticalCurve& operator= ( const Plot2d_AnalyticalCurve& );
60
61   virtual ~Plot2d_AnalyticalCurve();
62
63   virtual QwtPlotItem* plotItem();
64   virtual void         autoFill( const QwtPlot* );
65   virtual void         updatePlotItem();
66   virtual bool         checkCurve( const QwtPlot* );
67
68   virtual void         calculate();
69
70   long                 getData( double** , double** ) const;
71
72   void                 setSelected(const bool);
73   bool                 isSelected() const;
74
75
76
77   void                 setAutoAssign( bool );
78   bool                 isAutoAssign( ) const;
79
80   void                 setColor( const QColor& );
81   QColor               getColor() const;
82
83   void                 setMarker( Plot2d::MarkerType );
84   Plot2d::MarkerType   getMarker() const;
85
86   void                 setMarkerSize( const int );
87   int                  getMarkerSize() const;
88
89   void                 setLine( Plot2d::LineType );
90   Plot2d::LineType     getLine() const;
91
92   void                 setLineWidth( const int );
93   int                  getLineWidth() const;
94
95   void                 setNbIntervals( const long );
96   long                 getNbIntervals() const;
97
98   void                 setRangeBegin( const double );
99   double               getRangeBegin() const;
100
101   void                 setRangeEnd( const double );
102   double               getRangeEnd() const;
103
104   void                 setExpression( const QString& );
105   QString              getExpression() const;
106
107   void                 setName( const QString& );
108   QString              getName() const;
109
110   void                 setActive(const bool);
111   bool                 isActive() const;
112
113   void                 setAction(const int);
114   int                  getAction() const;
115   int                  state() const;
116
117
118 protected:
119   
120   bool                 myAutoAssign;
121   QColor               myColor;
122   Plot2d::MarkerType   myMarker;
123   int                  myMarkerSize;
124   Plot2d::LineType     myLine;
125   int                  myLineWidth;
126   long                 myNbIntervals;
127   pointList            myPoints;
128   double               myRangeBegin;
129   double               myRangeEnd;
130   QString              myExpression;
131   QString              myName; 
132   int                  myAction;
133   int                  myState;
134   QwtPlotItem*         myCurve;
135   bool                 myActive;
136   bool                 myIsSelected;
137
138 private:
139   static int           myNbCurves;
140
141 };
142
143 typedef QList<Plot2d_AnalyticalCurve*> AnalyticalCurveList;
144
145 class PLOT2D_EXPORT Plot2d_CurveContainer
146 {
147 public:
148   virtual void              addAnalyticalCurve( Plot2d_AnalyticalCurve* ) = 0;
149   virtual void              removeAnalyticalCurve( Plot2d_AnalyticalCurve* ) = 0;
150   virtual void              updateAnalyticalCurve( Plot2d_AnalyticalCurve*, bool = false ) = 0;
151   virtual void              updateAnalyticalCurves() = 0;
152   virtual AnalyticalCurveList getAnalyticalCurves() const = 0;
153 };
154
155 #endif //PLOT2D_ANALYTICAL_CURVE_H
156