]> SALOME platform Git repositories - modules/gui.git/blob - src/Plot2d/Plot2d_Curve.h
Salome HOME
PAL10190 - clone of plot2d
[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   void        setHorTitle( const QString& title );
33   QString     getHorTitle() const;
34   void        setVerTitle( const QString& title );
35   QString     getVerTitle() const;
36   void        setHorUnits( const QString& units );
37   QString     getHorUnits() const;
38   void        setVerUnits( const QString& units );
39   QString     getVerUnits() const;
40   void        addPoint(double theX, double theY);
41   void        insertPoint(int thePos, double theX, double theY);
42   void        deletePoint(int thePos);
43   void        clearAllPoints();
44   pointList   getPointList() const;
45
46   void        setData( const double* hData, const double* vData, long size );
47   double*     horData() const;
48   double*     verData() const;
49
50   int         nbPoints() const;
51   bool        isEmpty() const;
52
53   void        setAutoAssign( bool on );
54   bool        isAutoAssign() const;
55   void        setColor( const QColor& color );
56   QColor      getColor() const;
57   void        setMarker( MarkerType marker );
58   MarkerType  getMarker() const;
59   void        setLine( LineType line, const int lineWidth = 0 );
60   LineType    getLine() const;
61   int         getLineWidth() const;
62   void        setYAxis(QwtPlot::Axis theYAxis);
63   QwtPlot::Axis getYAxis() const;
64
65 protected:
66   bool        myAutoAssign;
67   QString     myHorTitle;
68   QString     myVerTitle;
69   QString     myHorUnits;
70   QString     myVerUnits;
71   QColor      myColor;
72   MarkerType  myMarker;
73   LineType    myLine;
74   int         myLineWidth;
75   QwtPlot::Axis myYAxis;
76
77   pointList   myPoints;
78 };
79
80 typedef QPtrList<Plot2d_Curve> curveList;
81
82 #endif