00001
00002
00003
00004
00005
00006
00007 #ifndef POINT_H
00008 #define POINT_H
00009
00010 #include <QPointF>
00011 #include <QString>
00012
00013 class QTextStream;
00014 class QXmlStreamReader;
00015 class QXmlStreamWriter;
00016
00017 enum ApplyHasCheck {
00018 KEEP_HAS_CHECK,
00019 SKIP_HAS_CHECK
00020 };
00021
00023 class Point
00024 {
00025 public:
00027 Point ();
00028
00031 Point (const QString &curveName,
00032 const QPointF &posScreen);
00033
00036 Point (const QString &curveName,
00037 const QPointF &posScreen,
00038 const QPointF &posGraph,
00039 bool isXOnly);
00040
00042 Point (const QString &curveName,
00043 const QString &identifier,
00044 const QPointF &posScreen,
00045 const QPointF &posGraph,
00046 double ordinal,
00047 bool isXOnly);
00048
00050 Point (const QString &curveName,
00051 const QPointF &posScreen,
00052 const QPointF &posGraph,
00053 double ordinal,
00054 bool isXOnly);
00055
00057 Point (const QString &curveName,
00058 const QString &identifier,
00059 const QPointF &posScreen,
00060 double ordinal);
00061
00063 Point (const QString &curveName,
00064 const QPointF &posScreen,
00065 double ordinal);
00066
00068 Point (QXmlStreamReader &reader);
00069
00071 Point &operator=(const Point &point);
00072
00074 Point (const Point &point);
00075
00077 static QString curveNameFromPointIdentifier (const QString &pointIdentifier);
00078
00080 bool hasOrdinal () const;
00081
00083 bool hasPosGraph () const;
00084
00086 QString identifier () const;
00087
00089 bool isXOnly() const;
00090
00092 static unsigned int identifierIndex ();
00093
00095 bool isAxisPoint () const;
00096
00098 double ordinal (ApplyHasCheck applyHasCheck = KEEP_HAS_CHECK) const;
00099
00101 QPointF posGraph (ApplyHasCheck applyHasCheck = KEEP_HAS_CHECK) const;
00102
00104 QPointF posScreen () const;
00105
00107 void printStream (QString indentation,
00108 QTextStream &str) const;
00109
00111 void saveXml(QXmlStreamWriter &writer) const;
00112
00114 void setCurveName (const QString &curveName);
00115
00117 static void setIdentifierIndex (unsigned int identifierIndex);
00118
00120 void setOrdinal (double ordinal);
00121
00123 void setPosGraph (const QPointF &posGraph);
00124
00126 void setPosScreen (const QPointF &posScreen);
00127
00129 static QString temporaryPointIdentifier ();
00130
00132 static double UNDEFINED_ORDINAL () { return -1.0; }
00133
00134 private:
00135
00137 void loadXml(QXmlStreamReader &reader);
00138
00144 static QString uniqueIdentifierGenerator(const QString &curveName);
00145
00146 bool m_isAxisPoint;
00147 QString m_identifier;
00148 QPointF m_posScreen;
00149 bool m_hasPosGraph;
00150 QPointF m_posGraph;
00151 bool m_hasOrdinal;
00152 double m_ordinal;
00153 bool m_isXOnly;
00154
00155 static unsigned int m_identifierIndex;
00156 };
00157
00158 #endif // POINT_H