Salome HOME
Copyrights update
[modules/gui.git] / src / Plot2d / Plot2d_Curve.h
1 // Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
2 // 
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either 
6 // version 2.1 of the License.
7 // 
8 // This library is distributed in the hope that it will be useful 
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of 
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public  
14 // License along with this library; if not, write to the Free Software 
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/
18 //
19 #ifndef PLOT2D_CURVE_H
20 #define PLOT2D_CURVE_H
21
22 #include "Plot2d.h"
23 #include <qvaluelist.h>
24 #include <qptrlist.h>
25 #include <qwt_plot.h>
26
27 class QColor;
28
29 typedef struct
30 {
31   double x;
32   double y;
33 } Plot2d_Point;
34
35 typedef QValueList<Plot2d_Point> pointList;
36
37 class PLOT2D_EXPORT Plot2d_Curve
38 {
39 public:
40   enum MarkerType { None,      Circle,    Rectangle, Diamond,
41         DTriangle, UTriangle, LTriangle, RTriangle,
42         Cross, XCross };
43   enum LineType { NoPen, Solid, Dash, Dot, DashDot, DashDotDot };
44
45   Plot2d_Curve();
46   virtual ~Plot2d_Curve();
47   Plot2d_Curve( const Plot2d_Curve& curve );
48   Plot2d_Curve& operator= ( const Plot2d_Curve& curve );
49
50   virtual QString getTableTitle() const;
51   
52   void        setHorTitle( const QString& title );
53   QString     getHorTitle() const;
54   void        setVerTitle( const QString& title );
55   QString     getVerTitle() const;
56   void        setHorUnits( const QString& units );
57   QString     getHorUnits() const;
58   void        setVerUnits( const QString& units );
59   QString     getVerUnits() const;
60   void        addPoint(double theX, double theY);
61   void        insertPoint(int thePos, double theX, double theY);
62   void        deletePoint(int thePos);
63   void        clearAllPoints();
64   pointList   getPointList() const;
65
66   void        setData( const double* hData, const double* vData, long size );
67   double*     horData() const;
68   double*     verData() const;
69
70   int         nbPoints() const;
71   bool        isEmpty() const;
72
73   void        setAutoAssign( bool on );
74   bool        isAutoAssign() const;
75   void        setColor( const QColor& color );
76   QColor      getColor() const;
77   void        setMarker( MarkerType marker );
78   MarkerType  getMarker() const;
79   void        setLine( LineType line, const int lineWidth = 0 );
80   LineType    getLine() const;
81   int         getLineWidth() const;
82   void        setYAxis(QwtPlot::Axis theYAxis);
83   QwtPlot::Axis getYAxis() const;
84
85 protected:
86   bool        myAutoAssign;
87   QString     myHorTitle;
88   QString     myVerTitle;
89   QString     myHorUnits;
90   QString     myVerUnits;
91   QColor      myColor;
92   MarkerType  myMarker;
93   LineType    myLine;
94   int         myLineWidth;
95   QwtPlot::Axis myYAxis;
96
97   pointList   myPoints;
98 };
99
100 typedef QPtrList<Plot2d_Curve> curveList;
101
102 #endif