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