1 /***************************************************************************
2  *                                                                         *
3  *   copyright : (C) 2007 The University of Toronto                        *
4  *                   netterfield@astro.utoronto.ca                         *
5  *                                                                         *
6  *   This program is free software; you can redistribute it and/or modify  *
7  *   it under the terms of the GNU General Public License as published by  *
8  *   the Free Software Foundation; either version 2 of the License, or     *
9  *   (at your option) any later version.                                   *
10  *                                                                         *
11  ***************************************************************************/
12 
13 #ifndef PLOTMARKERS_H
14 #define PLOTMARKERS_H
15 
16 #include "kst_export.h"
17 
18 #include "vector.h"
19 #include "curve.h"
20 
21 #include <QColor>
22 #include <QList>
23 
24 namespace Kst {
25 
26 class PlotMarkers {
27 
28   public:
29     enum CurveMarkerMode {
30       RisingEdge = 0,
31       FallingEdge = 1,
32       BothEdges = 2
33     };
34 
35     explicit PlotMarkers(bool xAxis = true);
36     virtual ~PlotMarkers();
37 
38     QList<double> markers();
39 
manualMarkers()40     QList<double> manualMarkers() const { return _manualMarkers; }
setManualMarkers(const QList<double> & markers)41     void setManualMarkers(const QList<double> &markers) { _manualMarkers = markers; }
42 
lineStyle()43     Qt::PenStyle lineStyle() const { return _lineStyle; }
setLineStyle(Qt::PenStyle style)44     void setLineStyle(Qt::PenStyle style) { _lineStyle = style; }
45 
lineColor()46     QColor lineColor() const { return _lineColor; }
setLineColor(const QColor & color)47     void setLineColor(const QColor &color) { _lineColor = color; }
48 
lineWidth()49     double lineWidth() const { return _lineWidth; }
setLineWidth(const double width)50     void setLineWidth(const double width) { _lineWidth = width; }
51 
isVectorSource()52     bool isVectorSource() const { return (_vector != 0); }
vector()53     VectorPtr vector() const { return _vector; }
setVector(VectorPtr vector)54     void setVector(VectorPtr vector) { _vector = vector; }
55 
isCurveSource()56     bool isCurveSource() const { return (_curve != 0); }
curve()57     CurvePtr curve() const { return _curve; }
setCurve(CurvePtr curve)58     void setCurve(CurvePtr curve) { _curve = curve; }
59 
curveMarkerMode()60     CurveMarkerMode curveMarkerMode() const { return _curveMode; }
setCurveMarkerMode(const CurveMarkerMode mode)61     void setCurveMarkerMode(const CurveMarkerMode mode) { _curveMode = mode; }
62 
63     void saveInPlot(QXmlStreamWriter &xml);
64     bool configureFromXml(QXmlStreamReader &xml, ObjectStore *store);
65 
66   private:
67     bool _xAxis;
68     QColor _lineColor;
69     Qt::PenStyle _lineStyle;
70     double _lineWidth;
71     CurveMarkerMode _curveMode;
72     VectorPtr _vector;
73     CurvePtr _curve;
74     QList<double> _manualMarkers;
75 };
76 
77 }
78 #endif
79 
80 // vim: ts=2 sw=2 et
81