Engauge Digitizer  2
ExportToClipboard.cpp
1 #include "CurvesGraphs.h"
2 #include "Document.h"
3 #include "EngaugeAssert.h"
4 #include "ExportToClipboard.h"
5 #include <QStringList>
6 #include <QTextStream>
7 
9 {
10 }
11 
12 void ExportToClipboard::exportToClipboard (const QStringList &selected,
13  const Transformation &transformation,
14  QTextStream &strCsv,
15  QTextStream &strHtml,
16  const Curve &curveAxis,
17  const CurvesGraphs &curvesGraphsAll,
18  CurvesGraphs &curvesGraphsSelected) const
19 {
20  // For speed, build a hash as a fast lookup table
21  QHash<QString, bool> selectedHash;
22  QStringList::const_iterator itrH;
23  for (itrH = selected.begin (); itrH != selected.end (); itrH++) {
24  QString pointIdentifier = *itrH;
25  selectedHash [pointIdentifier] = false;
26  }
27 
28  // List of curve names. Although we do not want axis points to be exported to the real
29  // clipboard, leaving out the axis curve would result in axis points not getting
30  // deleted. So we include the axis curve
31  QStringList curveNames = curvesGraphsAll.curvesGraphsNames();
32  curveNames << AXIS_CURVE_NAME;
33 
34  // Export
35  QStringList::const_iterator itrC;
36  for (itrC = curveNames.begin(); itrC != curveNames.end (); itrC++) {
37 
38  QString curveName = *itrC;
39  if (curveName == AXIS_CURVE_NAME) {
40  curveAxis.exportToClipboard (selectedHash,
41  transformation,
42  strCsv,
43  strHtml,
44  curvesGraphsSelected);
45  } else {
46  const Curve *curve = curvesGraphsAll.curveForCurveName(curveName);
47  ENGAUGE_CHECK_PTR (curve);
48  curve->exportToClipboard (selectedHash,
49  transformation,
50  strCsv,
51  strHtml,
52  curvesGraphsSelected);
53  }
54  }
55 }
void exportToClipboard(const QHash< QString, bool > &selectedHash, const Transformation &transformation, QTextStream &strCsv, QTextStream &strHtml, CurvesGraphs &curvesGraphs) const
Export points in this Curve found in the specified point list.
Definition: Curve.cpp:92
Curve * curveForCurveName(const QString &curveName)
Return the axis or graph curve for the specified curve name.
Affine transformation between screen and graph coordinates, based on digitized axis points...
Container for all graph curves. The axes point curve is external to this class.
Definition: CurvesGraphs.h:18
void exportToClipboard(const QStringList &selected, const Transformation &transformation, QTextStream &strCsv, QTextStream &strHtml, const Curve &curveAxis, const CurvesGraphs &curvesGraphsAll, CurvesGraphs &curvesGraphsSelected) const
Export, curve-by-curve, raw data points to a string that will be copied to the clipboard.
Container for one set of digitized Points.
Definition: Curve.h:24
ExportToClipboard()
Single constructor.
QStringList curvesGraphsNames() const
List of graph curve names.