Salome HOME
Popup item "Refresh"
[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   double*     horData() const;
47   double*     verData() const;
48   int         nbPoints() const;
49   bool        isEmpty() const;
50
51   void        setAutoAssign( bool on );
52   bool        isAutoAssign() const;
53   void        setColor( const QColor color );
54   QColor      getColor() const;
55   void        setMarker( MarkerType marker );
56   MarkerType  getMarker() const;
57   void        setLine( LineType line, const int lineWidth = 0 );
58   LineType    getLine() const;
59   int         getLineWidth() const;
60   void        setYAxis(QwtPlot::Axis theYAxis);
61   QwtPlot::Axis getYAxis() const;
62
63 protected:
64   bool        myAutoAssign;
65   QString     myHorTitle;
66   QString     myVerTitle;
67   QString     myHorUnits;
68   QString     myVerUnits;
69   QColor      myColor;
70   MarkerType  myMarker;
71   LineType    myLine;
72   int         myLineWidth;
73   QwtPlot::Axis myYAxis;
74
75   pointList   myPoints;
76 };
77
78 #endif