Salome HOME
5cc959483c5e0db0f40bacac9727b5fc5071c1b8
[modules/kernel.git] / src / Plot2d / Plot2d_Curve.h
1 //  Copyright (C) 2003  CEA/DEN, EDF R&D
2 //
3 //
4 //
5 //  File   : Plot2d_Curve.h
6 //  Author : Vadim SANDLER
7 //  Module : SALOME
8 //  $Header$
9
10 #ifndef Plot2d_Curve_h
11 #define Plot2d_Curve_h
12
13 #include <qstring.h>
14 #include <qcolor.h>
15 #include <qmemarray.h>
16 #ifndef _Handle_SALOME_InteractiveObject_HeaderFile
17 #include <Handle_SALOME_InteractiveObject.hxx>
18 #endif
19 #include "SALOME_InteractiveObject.hxx"
20
21 typedef QMemArray<double> DoubleArray;
22
23 class Plot2d_Curve 
24 {
25 public:
26   enum MarkerType { None,      Circle,    Rectangle, Diamond,
27                     DTriangle, UTriangle, LTriangle, RTriangle,
28                     Cross, XCross };
29   enum LineType { NoPen, Solid, Dash, Dot, DashDot, DashDotDot };
30
31   Plot2d_Curve();
32   ~Plot2d_Curve();
33   Plot2d_Curve( const Plot2d_Curve& curve );
34   Plot2d_Curve& operator= ( const Plot2d_Curve& curve );
35
36   void        setHorTitle( const QString& title );
37   QString     getHorTitle() const;
38   void        setVerTitle( const QString& title );
39   QString     getVerTitle() const;
40   void        setHorUnits( const QString& units );
41   QString     getHorUnits() const;
42   void        setVerUnits( const QString& units );
43   QString     getVerUnits() const;
44   void        setData( const double* hData, const double* vData, long size );
45   double*     horData() const;
46   double*     verData() const;
47   long        nbPoints() const;
48   bool        isEmpty() const;
49
50   void        setAutoAssign( bool on );
51   bool        isAutoAssign() const;
52   void        setColor( const QColor color );
53   QColor      getColor() const;
54   void        setMarker( MarkerType marker );
55   MarkerType  getMarker() const;
56   void        setLine( LineType line, const int lineWidth = 0 );
57   LineType    getLine() const;
58   int         getLineWidth() const;
59
60   virtual bool                             hasIO() { return !myIO.IsNull(); }
61   virtual Handle(SALOME_InteractiveObject) getIO() { return myIO; }
62   virtual void                             setIO( const Handle(SALOME_InteractiveObject)& io ) { myIO = io; }
63
64   virtual bool                             hasTableIO() { return !myTableIO.IsNull(); }
65   virtual Handle(SALOME_InteractiveObject) getTableIO() { return myTableIO; }
66   virtual void                             setTableIO( const Handle(SALOME_InteractiveObject)& io ) { myTableIO = io; }
67   
68 private:
69   Handle(SALOME_InteractiveObject) myIO;
70   Handle(SALOME_InteractiveObject) myTableIO;
71
72   bool        myAutoAssign;
73   QString     myHorTitle;
74   QString     myVerTitle;
75   QString     myHorUnits;
76   QString     myVerUnits;
77   QColor      myColor;
78   MarkerType  myMarker;
79   LineType    myLine;
80   int         myLineWidth;
81   DoubleArray myHorData;
82   DoubleArray myVerData;
83 };
84
85 #endif // Plot2d_Curve_h
86
87