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