Engauge Digitizer 2
Loading...
Searching...
No Matches
MimePointsImport.cpp
Go to the documentation of this file.
1/******************************************************************************************************
2 * (C) 2017 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 "MimePointsImport.h"
8#include <QApplication>
9#include <QClipboard>
10#include "Transformation.h"
11
15
19
21 QList<QPoint> &points,
23{
24 // Sanity checking by MimePointsDetector::isMimePointsData has already been done
25
26 const QString TAB_DELIMITER ("\t");
27
28 const QClipboard *clipboard = QApplication::clipboard();
29 QString text = clipboard->text ();
30 QStringList lines = text.split ("\n");
31
32 // Loop through lines
33 int ordinal = 0;
34 for (int i = 0; i < lines.count(); i++) {
35
36 QString line = lines.at (i);
37
38 // Skip empty lines
40 if (!line.trimmed ().isEmpty () &&
41 fields.count () == 2) {
42
43 QString field0 = fields [0];
44 QString field1 = fields [1];
45 bool ok0, ok1;
46 double value0 = field0.toDouble (&ok0);
47 double value1 = field1.toDouble (&ok1);
48 if (ok0 && ok1) {
49
53
54 points.push_back (pointScreen.toPoint ());
55 ordinals.push_back (ordinal++);
56 }
57 }
58 }
59}
const QString TAB_DELIMITER("\t")
const int INNER_RADIUS_MIN
virtual ~MimePointsImport()
Destructor.
MimePointsImport()
Default constructor.
void retrievePoints(const Transformation &transformation, QList< QPoint > &points, QList< double > &ordinals) const
Retrieve points from clipboard.
Affine transformation between screen and graph coordinates, based on digitized axis points.
void transformRawGraphToScreen(const QPointF &pointRaw, QPointF &pointScreen) const
Transform from raw graph coordinates to linear cartesian graph coordinates, then to screen coordinate...