2 #include "CurvesGraphs.h"
3 #include "CurveStyles.h"
4 #include "DocumentSerialize.h"
5 #include "EngaugeAssert.h"
9 #include <QXmlStreamWriter>
10 #include "Transformation.h"
13 CurvesGraphs::CurvesGraphs()
19 m_curvesGraphs.push_back (curve);
27 curve->addPoint (point);
33 CurveList::iterator itr;
34 for (itr = m_curvesGraphs.begin (); itr != m_curvesGraphs.end (); itr++) {
48 CurveList::const_iterator itr;
49 for (itr = m_curvesGraphs.begin (); itr != m_curvesGraphs.end (); itr++) {
51 const Curve &curve = *itr;
64 CurveList::const_iterator itr;
65 for (itr = m_curvesGraphs.begin (); itr != m_curvesGraphs.end (); itr++) {
67 const Curve &curve = *itr;
77 CurveList::const_iterator itr;
78 for (itr = m_curvesGraphs.begin (); itr != m_curvesGraphs.end (); itr++) {
80 const Curve &curve = *itr;
90 const Functor2wRet<const QString &, const Point &, CallbackSearchReturn> &ftorWithCallback)
93 CurveList::const_iterator itr;
94 for (itr = m_curvesGraphs.begin (); itr != m_curvesGraphs.end (); itr++) {
96 const Curve &curve = *itr;
97 if (curve.
curveName () == curveNameWanted) {
104 ENGAUGE_ASSERT (
false);
108 const Functor2wRet<const Point &, const Point &, CallbackSearchReturn> &ftorWithCallback)
const
111 CurveList::const_iterator itr;
112 for (itr = m_curvesGraphs.begin (); itr != m_curvesGraphs.end (); itr++) {
114 const Curve &curve = *itr;
115 if (curve.
curveName () == curveNameWanted) {
122 ENGAUGE_ASSERT (
false);
127 CurveList::const_iterator itr;
128 for (itr = m_curvesGraphs.begin (); itr != m_curvesGraphs.end (); itr++) {
130 const Curve &curve = *itr;
137 CurveList::const_iterator itr;
138 for (itr = m_curvesGraphs.begin (); itr != m_curvesGraphs.end (); itr++) {
140 const Curve &curve = *itr;
147 LOG4CPP_INFO_S ((*mainCat)) <<
"CurvesGraphs::loadXml";
152 while ((reader.tokenType() != QXmlStreamReader::EndElement) ||
153 (reader.name() != DOCUMENT_SERIALIZE_CURVES_GRAPHS)){
155 if ((reader.tokenType() == QXmlStreamReader::StartElement) &&
156 (reader.name () == DOCUMENT_SERIALIZE_CURVE)) {
158 Curve curve (reader);
160 m_curvesGraphs.push_back (curve);
164 loadNextFromReader(reader);
165 if (reader.hasError()) {
170 if (reader.atEnd()) {
178 reader.raiseError (
"Cannot read graph curves data");
184 return m_curvesGraphs.count ();
188 QTextStream &str)
const
190 str << indentation <<
"CurvesGraphs\n";
192 indentation += INDENTATION_DELTA;
194 CurveList::const_iterator itr;
195 for (itr = m_curvesGraphs.begin (); itr != m_curvesGraphs.end (); itr++) {
197 const Curve &curve = *itr;
213 LOG4CPP_INFO_S ((*mainCat)) <<
"CurvesGraphs::saveXml";
215 writer.writeStartElement(DOCUMENT_SERIALIZE_CURVES_GRAPHS);
217 CurveList::const_iterator itr;
218 for (itr = m_curvesGraphs.begin (); itr != m_curvesGraphs.end (); itr++) {
220 const Curve &curve = *itr;
224 writer.writeEndElement();
229 LOG4CPP_INFO_S ((*mainCat)) <<
"CurvesGraphs::updatePointOrdinals";
231 CurveList::iterator itr;
232 for (itr = m_curvesGraphs.begin (); itr != m_curvesGraphs.end (); itr++) {
void removePoint(const QString &identifier)
Perform the opposite of addPointAtEnd.
static QString curveNameFromPointIdentifier(const QString &pointIdentifier)
Parse the curve name from the specified point identifier. This does the opposite of uniqueIdentifierG...
void saveXml(QXmlStreamWriter &writer) const
Serialize curves.
void printStream(QString indentation, QTextStream &str) const
Debugging method that supports print method of this class and printStream method of some other class(...
void loadXml(QXmlStreamReader &reader)
Load from serialized file.
void iterateThroughCurveSegments(const QString &curveNameWanted, const Functor2wRet< const Point &, const Point &, CallbackSearchReturn > &ftorWithCallback) const
Apply functor to segments on the specified axis or graph Curve.
Curve * curveForCurveName(const QString &curveName)
Return the axis or graph curve for the specified curve name.
int numCurves() const
Current number of graphs curves.
int numPoints() const
Number of points.
void updatePointOrdinals(const Transformation &transformation)
See CurveGraphs::updatePointOrdinals.
void addGraphCurveAtEnd(Curve curve)
Append new graph Curve to end of Curve list.
void iterateThroughCurvesPoints(const Functor2wRet< const QString &, const Point &, CallbackSearchReturn > &ftorWithCallback)
Apply functor to Points on all of the Curves.
Class that represents one digitized point. The screen-to-graph coordinate transformation is always ex...
void printStream(QString indentation, QTextStream &str) const
Debugging method that supports print method of this class and printStream method of some other class(...
QString identifier() const
Unique identifier for a specific Point.
void addPoint(const Point &point)
Append new Point to the specified Curve.
void iterateThroughCurvePoints(const QString &curveNameWanted, const Functor2wRet< const QString &, const Point &, CallbackSearchReturn > &ftorWithCallback)
Apply functor to Points in the specified axis or graph Curve.
void iterateThroughCurvePoints(const Functor2wRet< const QString &, const Point &, CallbackSearchReturn > &ftorWithCallback) const
Apply functor to Points on Curve.
int curvesGraphsNumPoints(const QString &curveName) const
Point count.
Container for one set of digitized Points.
void updatePointOrdinals(const Transformation &transformation)
Update point ordinals to be consistent with their CurveStyle and x/theta coordinate.
QStringList curvesGraphsNames() const
List of graph curve names.
void removePoint(const QString &pointIdentifier)
Remove the Point from its Curve.
void iterateThroughCurveSegments(const Functor2wRet< const Point &, const Point &, CallbackSearchReturn > &ftorWithCallback) const
Apply functor to successive Points, as line segments, on Curve. This could be a bit slow...
void saveXml(QXmlStreamWriter &writer) const
Serialize curve.
QString curveName() const
Name of this Curve.