Salome HOME
004d6d761665d73b7bf7e8d70d91013e6227144d
[modules/gui.git] / src / Plot2d / Plot2d_Curve.h
1 #ifndef PLOT2D_CURVE_H
2 #define PLOT2D_CURVE_H
3
4 #include "Plot2d.h"
5 #include <qvaluelist.h>
6 #include <qptrlist.h>
7 #include <qwt_plot.h>
8
9 class QColor;
10
11 typedef struct
12 {
13   double x;
14   double y;
15 } Plot2d_Point;
16
17 typedef QValueList<Plot2d_Point> pointList;
18
19 class PLOT2D_EXPORT Plot2d_Curve
20 {
21 public:
22   enum MarkerType { None,      Circle,    Rectangle, Diamond,
23         DTriangle, UTriangle, LTriangle, RTriangle,
24         Cross, XCross };
25   enum LineType { NoPen, Solid, Dash, Dot, DashDot, DashDotDot };
26
27   Plot2d_Curve();
28   virtual ~Plot2d_Curve();
29   Plot2d_Curve( const Plot2d_Curve& curve );
30   Plot2d_Curve& operator= ( const Plot2d_Curve& curve );
31
32   virtual QString getTableTitle() const;
33   
34   void        setHorTitle( const QString& title );
35   QString     getHorTitle() const;
36   void        setVerTitle( const QString& title );
37   QString     getVerTitle() const;
38   void        setHorUnits( const QString& units );
39   QString     getHorUnits() const;
40   void        setVerUnits( const QString& units );
41   QString     getVerUnits() const;
42   void        addPoint(double theX, double theY);
43   void        insertPoint(int thePos, double theX, double theY);
44   void        deletePoint(int thePos);
45   void        clearAllPoints();
46   pointList   getPointList() const;
47
48   void        setData( const double* hData, const double* vData, long size );
49   double*     horData() const;
50   double*     verData() const;
51
52   int         nbPoints() const;
53   bool        isEmpty() const;
54
55   void        setAutoAssign( bool on );
56   bool        isAutoAssign() const;
57   void        setColor( const QColor& color );
58   QColor      getColor() const;
59   void        setMarker( MarkerType marker );
60   MarkerType  getMarker() const;
61   void        setLine( LineType line, const int lineWidth = 0 );
62   LineType    getLine() const;
63   int         getLineWidth() const;
64   void        setYAxis(QwtPlot::Axis theYAxis);
65   QwtPlot::Axis getYAxis() const;
66
67 protected:
68   bool        myAutoAssign;
69   QString     myHorTitle;
70   QString     myVerTitle;
71   QString     myHorUnits;
72   QString     myVerUnits;
73   QColor      myColor;
74   MarkerType  myMarker;
75   LineType    myLine;
76   int         myLineWidth;
77   QwtPlot::Axis myYAxis;
78
79   pointList   myPoints;
80 };
81
82 typedef QPtrList<Plot2d_Curve> curveList;
83
84 #endif