Engauge Digitizer 2
Loading...
Searching...
No Matches
ExportToClipboard.cpp
Go to the documentation of this file.
1/******************************************************************************************************
2 * (C) 2014 markummitchell@github.com. This file is part of Engauge Digitizer, which is released *
3 * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file *
4 * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. *
5 ******************************************************************************************************/
6
7#include "CurvesGraphs.h"
8#include "Document.h"
9#include "EngaugeAssert.h"
10#include "ExportToClipboard.h"
11#include <QStringList>
12#include <QTextStream>
13
17
18void ExportToClipboard::exportToClipboard (const QStringList &selected,
19 const Transformation &transformation,
20 QTextStream &strCsv,
21 QTextStream &strHtml,
22 const Curve &curveAxis,
23 const CurvesGraphs &curvesGraphsAll,
24 CurvesGraphs &curvesGraphsSelected) const
25{
26 // For speed, build a hash as a fast lookup table
27 QHash<QString, bool> selectedHash;
28 QStringList::const_iterator itrH;
29 for (itrH = selected.begin (); itrH != selected.end (); itrH++) {
30 QString pointIdentifier = *itrH;
31 selectedHash [pointIdentifier] = false;
32 }
33
34 // List of curve names. Although we do not want axis points to be exported to the real
35 // clipboard, leaving out the axis curve would result in axis points not getting
36 // deleted. So we include the axis curve
37 QStringList curveNames = curvesGraphsAll.curvesGraphsNames();
38 curveNames << AXIS_CURVE_NAME;
39
40 // Export
41 QStringList::const_iterator itrC;
42 for (itrC = curveNames.begin(); itrC != curveNames.end (); itrC++) {
43
44 QString curveName = *itrC;
45 if (curveName == AXIS_CURVE_NAME) {
46 curveAxis.exportToClipboard (selectedHash,
47 transformation,
48 strCsv,
49 strHtml,
50 curvesGraphsSelected);
51 } else {
52 const Curve *curve = curvesGraphsAll.curveForCurveName(curveName);
53 ENGAUGE_CHECK_PTR (curve);
54 curve->exportToClipboard (selectedHash,
55 transformation,
56 strCsv,
57 strHtml,
58 curvesGraphsSelected);
59 }
60 }
61}
const QString AXIS_CURVE_NAME
#define ENGAUGE_CHECK_PTR(ptr)
Drop in replacement for Q_CHECK_PTR.
Container for one set of digitized Points.
Definition Curve.h:34
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:220
Container for all graph curves. The axes point curve is external to this class.
Curve * curveForCurveName(const QString &curveName)
Return the axis or graph curve for the specified curve name.
QStringList curvesGraphsNames() const
List of graph curve names.
ExportToClipboard()
Single constructor.
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.
Affine transformation between screen and graph coordinates, based on digitized axis points.