00001
00002
00003
00004
00005
00006
00007 #ifndef CURVE_H
00008 #define CURVE_H
00009
00010 #include "CallbackSearchReturn.h"
00011 #include "ColorFilterSettings.h"
00012 #include "CurveStyle.h"
00013 #include "functor.h"
00014 #include "Point.h"
00015 #include "Points.h"
00016 #include <QHash>
00017 #include <QList>
00018 #include <QString>
00019
00020 extern const QString AXIS_CURVE_NAME;
00021 extern const QString DEFAULT_GRAPH_CURVE_NAME;
00022 extern const QString DUMMY_CURVE_NAME;
00023
00024 class CurvesGraphs;
00025 class QDataStream;
00026 class QTextStream;
00027 class QXmlStreamReader;
00028 class QXmlStreamWriter;
00029 class Transformation;
00030
00032 class Curve
00033 {
00034 public:
00036 Curve(const QString &curveName,
00037 const ColorFilterSettings &colorFilterSettings,
00038 const CurveStyle &curveStyle);
00039
00041 Curve (QDataStream &str);
00042
00044 Curve (QXmlStreamReader &reader);
00045
00047 Curve (const Curve &curve);
00048
00050 Curve &operator=(const Curve &curve);
00051
00053 void addPoint (Point point);
00054
00056 ColorFilterSettings colorFilterSettings () const;
00057
00059 QString curveName () const;
00060
00062 CurveStyle curveStyle() const;
00063
00065 void editPointAxis (const QPointF &posGraph,
00066 const QString &identifier);
00067
00069 void editPointGraph (bool isX,
00070 bool isY,
00071 double x,
00072 double y,
00073 const QStringList &identifiers,
00074 const Transformation &transformation);
00075
00077 void exportToClipboard (const QHash<QString, bool> &selectedHash,
00078 const Transformation &transformation,
00079 QTextStream &strCsv,
00080 QTextStream &strHtml,
00081 CurvesGraphs &curvesGraphs) const;
00082
00084 bool isXOnly (const QString &pointIdentifier) const;
00085
00087 void iterateThroughCurvePoints (const Functor2wRet<const QString &, const Point &, CallbackSearchReturn> &ftorWithCallback) const;
00088
00090 void iterateThroughCurveSegments (const Functor2wRet<const Point &, const Point &, CallbackSearchReturn> &ftorWithCallback) const;
00091
00093 void movePoint (const QString &pointIdentifier,
00094 const QPointF &deltaScreen);
00095
00097 int numPoints () const;
00098
00100 const Points points () const;
00101
00103 QPointF positionGraph (const QString &pointIdentifier) const;
00104
00106 QPointF positionScreen (const QString &pointIdentifier) const;
00107
00109 void printStream (QString indentation,
00110 QTextStream &str) const;
00111
00113 void removePoint (const QString &identifier);
00114
00116 void saveXml(QXmlStreamWriter &writer) const;
00117
00119 void setColorFilterSettings (const ColorFilterSettings &colorFilterSettings);
00120
00122 void setCurveName (const QString &curveName);
00123
00125 void setCurveStyle (const CurveStyle &curveStyle);
00126
00129 void updatePointOrdinals (const Transformation &transformation);
00130
00131 private:
00132 Curve();
00133
00134 void loadCurvePoints(QXmlStreamReader &reader);
00135 void loadXml(QXmlStreamReader &reader);
00136 Point *pointForPointIdentifier (const QString pointIdentifier);
00137 void updatePointOrdinalsFunctions (const Transformation &transformation);
00138 void updatePointOrdinalsRelations ();
00139
00140 QString m_curveName;
00141 Points m_points;
00142
00143 ColorFilterSettings m_colorFilterSettings;
00144 CurveStyle m_curveStyle;
00145 };
00146
00147 #endif // CURVE_H