Engauge Digitizer  2
 All Classes Files Functions Variables Enumerations Enumerator Friends Pages
Curve.cpp
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 "Curve.h"
8 #include "CurvesGraphs.h"
9 #include "CurveStyle.h"
10 #include "DocumentSerialize.h"
11 #include "EngaugeAssert.h"
12 #include "Logger.h"
13 #include "MigrateToVersion6.h"
14 #include "Point.h"
15 #include "PointComparator.h"
16 #include <QDataStream>
17 #include <QDebug>
18 #include <QMap>
19 #include <QTextStream>
20 #include <QXmlStreamReader>
21 #include <QXmlStreamWriter>
22 #include "Transformation.h"
23 #include "Xml.h"
24 
25 const QString AXIS_CURVE_NAME ("Axes");
26 const QString DEFAULT_GRAPH_CURVE_NAME ("Curve1");
27 const QString DUMMY_CURVE_NAME ("dummy");
28 const QString TAB_DELIMITER ("\t");
29 
30 typedef QMap<double, QString> XOrThetaToPointIdentifier;
31 
32 Curve::Curve(const QString &curveName,
33  const ColorFilterSettings &colorFilterSettings,
34  const CurveStyle &curveStyle) :
35  m_curveName (curveName),
36  m_colorFilterSettings (colorFilterSettings),
37  m_curveStyle (curveStyle)
38 {
39 }
40 
41 Curve::Curve (const Curve &curve) :
42  m_curveName (curve.curveName ()),
43  m_points (curve.points ()),
44  m_colorFilterSettings (curve.colorFilterSettings ()),
45  m_curveStyle (curve.curveStyle ())
46 {
47 }
48 
49 Curve::Curve (QDataStream &str)
50 {
51  const int CONVERT_ENUM_TO_RADIUS = 6;
52  MigrateToVersion6 migrate;
53 
54  qint32 int32, xScreen, yScreen;
55  double xGraph, yGraph;
56 
57  str >> m_curveName;
58  str >> int32;
59  m_curveStyle.setPointShape(migrate.pointShape (int32));
60  str >> int32;
61  m_curveStyle.setPointRadius(int32 + CONVERT_ENUM_TO_RADIUS);
62  str >> int32;
63  m_curveStyle.setPointLineWidth (int32);
64  str >> int32;
65  m_curveStyle.setPointColor(migrate.colorPalette (int32));
66  str >> int32; // Point interior color
67  str >> int32;
68  m_curveStyle.setLineWidth(int32);
69  str >> int32;
70  if (m_curveName == AXIS_CURVE_NAME) {
71  m_curveStyle.setLineColor(migrate.colorPalette (int32));
72  } else {
73  m_curveStyle.setLineColor(COLOR_PALETTE_TRANSPARENT);
74  }
75  str >> int32;
76  m_curveStyle.setLineConnectAs(migrate.curveConnectAs (int32));
77 
78  str >> int32;
79  int count = int32;
80  int ordinal = 0;
81  for (int i = 0; i < count; i++) {
82 
83  str >> xScreen;
84  str >> yScreen;
85  str >> xGraph;
86  str >> yGraph;
87  if (m_curveName == AXIS_CURVE_NAME) {
88 
89  // Axis point, with graph coordinates set by user and managed here
90  Point point (m_curveName,
91  QPointF (xScreen, yScreen),
92  QPointF (xGraph, yGraph),
93  ordinal++,
94  false);
95 
96  addPoint(point);
97  } else {
98 
99  // Curve point, with graph coordinates managed elsewhere
100  Point point (m_curveName,
101  QPointF (xScreen, yScreen));
102  point.setOrdinal (ordinal++);
103 
104  addPoint(point);
105  }
106  }
107 }
108 
109 Curve::Curve (QXmlStreamReader &reader)
110 {
111  loadXml(reader);
112 }
113 
115 {
116  m_curveName = curve.curveName ();
117  m_points = curve.points ();
118  m_colorFilterSettings = curve.colorFilterSettings ();
119  m_curveStyle = curve.curveStyle ();
120 
121  return *this;
122 }
123 
124 void Curve::addPoint (Point point)
125 {
126  m_points.push_back (point);
127 }
128 
130 {
131  return m_colorFilterSettings;
132 }
133 
134 QString Curve::curveName () const
135 {
136  return m_curveName;
137 }
138 
140 {
141  return m_curveStyle;
142 }
143 
144 void Curve::editPointAxis (const QPointF &posGraph,
145  const QString &identifier)
146 {
147  // Search for the point with matching identifier
148  QList<Point>::iterator itr;
149  for (itr = m_points.begin (); itr != m_points.end (); itr++) {
150 
151  Point &point = *itr;
152  if (point.identifier () == identifier) {
153 
154  point.setPosGraph (posGraph);
155  break;
156 
157  }
158  }
159 }
160 
161 void Curve::editPointGraph (bool isX,
162  bool isY,
163  double x,
164  double y,
165  const QStringList &identifiers,
166  const Transformation &transformation)
167 {
168  LOG4CPP_INFO_S ((*mainCat)) << "Curve::editPointGraph"
169  << " identifiers=" << identifiers.join(" ").toLatin1().data();
170 
171  if (transformation.transformIsDefined()) {
172 
173  // Search for the point with matching identifier
174  QList<Point>::iterator itr;
175  for (itr = m_points.begin(); itr != m_points.end(); itr++) {
176 
177  Point &point = *itr;
178 
179  if (identifiers.contains (point.identifier ())) {
180 
181  // Although one or more graph coordinates are specified, it is the screen coordinates that must be
182  // moved. This is because only the screen coordinates of the graph points are tracked (not the graph coordinates).
183  // So we compute posScreen and call Point::setPosScreen instead of Point::setPosGraph
184 
185  // Get original graph coordinates
186  QPointF posScreen = point.posScreen ();
187  QPointF posGraph;
188  transformation.transformScreenToRawGraph (posScreen,
189  posGraph);
190 
191  // Override one or both coordinates
192  if (isX) {
193  posGraph.setX (x);
194  }
195 
196  if (isY) {
197  posGraph.setY (y);
198  }
199 
200  // Set the screen coordinates
201  transformation.transformRawGraphToScreen(posGraph,
202  posScreen);
203 
204  point.setPosScreen (posScreen);
205  }
206  }
207  }
208 }
209 
210 void Curve::exportToClipboard (const QHash<QString, bool> &selectedHash,
211  const Transformation &transformation,
212  QTextStream &strCsv,
213  QTextStream &strHtml,
214  CurvesGraphs &curvesGraphs) const
215 {
216  LOG4CPP_INFO_S ((*mainCat)) << "Curve::exportToClipboard"
217  << " hashCount=" << selectedHash.count();
218 
219  // This method assumes Copy is only allowed when Transformation is valid
220 
221  bool isFirst = true;
222  QList<Point>::const_iterator itr;
223  for (itr = m_points.begin (); itr != m_points.end (); itr++) {
224 
225  const Point &point = *itr;
226  if (selectedHash.contains (point.identifier ())) {
227 
228  if (isFirst) {
229 
230  // Insert headers to identify the points that follow
231  isFirst = false;
232  strCsv << "X" << TAB_DELIMITER << m_curveName << "\n";
233  strHtml << "<table>\n"
234  << "<tr><th>X</th><th>" << m_curveName << "</th></tr>\n";
235  }
236 
237  // Default curve style
238  CurveStyle curveStyleDefault;
239  curveStyleDefault.setLineStyle(LineStyle::defaultAxesCurve());
240  curveStyleDefault.setPointStyle(PointStyle::defaultGraphCurve (curvesGraphs.numCurves ()));
241 
242  // Check if this curve already exists from a previously exported point
243  if (curvesGraphs.curveForCurveName (m_curveName) == 0) {
244  Curve curve(m_curveName,
246  curveStyleDefault);
247  curvesGraphs.addGraphCurveAtEnd(curve);
248  }
249 
250  // Start with screen coordinates
251  QPointF pos = point.posScreen();
252  if (transformation.transformIsDefined()) {
253 
254  // Replace with graph coordinates which are almost always more useful
255  QPointF posGraph;
256  transformation.transformScreenToRawGraph(pos,
257  posGraph);
258  pos = posGraph;
259  }
260 
261  // Add point to text going to clipboard
262  strCsv << pos.x() << TAB_DELIMITER << pos.y() << "\n";
263  strHtml << "<tr><td>" << pos.x() << "</td><td>" << pos.y() << "</td></tr>\n";
264 
265  // Add point to list for undo/redo
266  curvesGraphs.curveForCurveName (m_curveName)->addPoint (point);
267  }
268  }
269 
270  if (!isFirst) {
271  strHtml << "</table>\n";
272  }
273 }
274 
275 bool Curve::isXOnly(const QString &pointIdentifier) const
276 {
277  // Search for point with matching identifier
278  Points::const_iterator itr;
279  for (itr = m_points.begin (); itr != m_points.end (); itr++) {
280  const Point &point = *itr;
281  if (pointIdentifier == point.identifier ()) {
282  return point.isXOnly();
283  break;
284  }
285  }
286 
287  ENGAUGE_ASSERT (false);
288 
289  return false;
290 }
291 
292 void Curve::iterateThroughCurvePoints (const Functor2wRet<const QString &, const Point&, CallbackSearchReturn> &ftorWithCallback) const
293 {
294  QList<Point>::const_iterator itr;
295  for (itr = m_points.begin (); itr != m_points.end (); itr++) {
296 
297  const Point &point = *itr;
298 
299  CallbackSearchReturn rtn = ftorWithCallback (m_curveName, point);
300 
302  break;
303  }
304  }
305 }
306 
307 void Curve::iterateThroughCurveSegments (const Functor2wRet<const Point&, const Point&, CallbackSearchReturn> &ftorWithCallback) const
308 {
309  // Loop through Points. They are assumed to be already sorted by their ordinals, but we do NOT
310  // check the ordinal ordering since this could be called before, or while, the ordinal sorting is done
311  QList<Point>::const_iterator itr;
312  const Point *pointBefore = 0;
313  for (itr = m_points.begin(); itr != m_points.end(); itr++) {
314 
315  const Point &point = *itr;
316 
317  if (pointBefore != 0) {
318 
319  CallbackSearchReturn rtn = ftorWithCallback (*pointBefore,
320  point);
321 
323  break;
324  }
325 
326  }
327  pointBefore = &point;
328  }
329 }
330 
331 void Curve::loadCurvePoints(QXmlStreamReader &reader)
332 {
333  LOG4CPP_INFO_S ((*mainCat)) << "Curve::loadCurvePoints";
334 
335  bool success = true;
336 
337  while ((reader.tokenType() != QXmlStreamReader::EndElement) ||
338  (reader.name() != DOCUMENT_SERIALIZE_CURVE_POINTS)) {
339 
340  QXmlStreamReader::TokenType tokenType = loadNextFromReader(reader);
341 
342  if (reader.atEnd()) {
343  success = false;
344  break;
345  }
346 
347  if (tokenType == QXmlStreamReader::StartElement) {
348 
349  if (reader.name () == DOCUMENT_SERIALIZE_POINT) {
350 
351  Point point (reader);
352  m_points.push_back (point);
353  }
354  }
355  }
356 
357  if (!success) {
358  reader.raiseError(QObject::tr ("Cannot read curve data"));
359  }
360 }
361 
362 void Curve::loadXml(QXmlStreamReader &reader)
363 {
364  LOG4CPP_INFO_S ((*mainCat)) << "Curve::loadXml";
365 
366  bool success = true;
367 
368  QXmlStreamAttributes attributes = reader.attributes();
369 
370  if (attributes.hasAttribute (DOCUMENT_SERIALIZE_CURVE_NAME)) {
371 
372  setCurveName (attributes.value (DOCUMENT_SERIALIZE_CURVE_NAME).toString());
373 
374  // Read until end of this subtree
375  while ((reader.tokenType() != QXmlStreamReader::EndElement) ||
376  (reader.name() != DOCUMENT_SERIALIZE_CURVE)){
377 
378  QXmlStreamReader::TokenType tokenType = loadNextFromReader(reader);
379 
380  if (reader.atEnd()) {
381  success = false;
382  break;
383  }
384 
385  if (tokenType == QXmlStreamReader::StartElement) {
386 
387  if (reader.name() == DOCUMENT_SERIALIZE_COLOR_FILTER) {
388  m_colorFilterSettings.loadXml(reader);
389  } else if (reader.name() == DOCUMENT_SERIALIZE_CURVE_POINTS) {
390  loadCurvePoints(reader);
391  } else if (reader.name() == DOCUMENT_SERIALIZE_CURVE_STYLE) {
392  m_curveStyle.loadXml(reader);
393  } else {
394  success = false;
395  break;
396  }
397  }
398 
399  if (reader.hasError()) {
400  // No need to set success flag to indicate failure, which raises the error, since the error was already raised. Just
401  // need to exit the loop immediately
402  break;
403  }
404  }
405  } else {
406  success = false;
407  }
408 
409  if (!success) {
410  reader.raiseError (QObject::tr ("Cannot read curve data"));
411  }
412 }
413 
414 void Curve::movePoint (const QString &pointIdentifier,
415  const QPointF &deltaScreen)
416 {
417  Point *point = pointForPointIdentifier (pointIdentifier);
418 
419  QPointF posScreen = deltaScreen + point->posScreen ();
420  point->setPosScreen (posScreen);
421 }
422 
423 int Curve::numPoints () const
424 {
425  return m_points.count ();
426 }
427 
428 Point *Curve::pointForPointIdentifier (const QString pointIdentifier)
429 {
430  Points::iterator itr;
431  for (itr = m_points.begin (); itr != m_points.end (); itr++) {
432  Point &point = *itr;
433  if (pointIdentifier == point.identifier ()) {
434  return &point;
435  }
436  }
437 
438  ENGAUGE_ASSERT (false);
439  return 0;
440 }
441 
442 const Points Curve::points () const
443 {
444  return m_points;
445 }
446 
447 QPointF Curve::positionGraph (const QString &pointIdentifier) const
448 {
449  QPointF posGraph;
450 
451  // Search for point with matching identifier
452  Points::const_iterator itr;
453  for (itr = m_points.begin (); itr != m_points.end (); itr++) {
454  const Point &point = *itr;
455  if (pointIdentifier == point.identifier ()) {
456  posGraph = point.posGraph ();
457  break;
458  }
459  }
460 
461  return posGraph;
462 }
463 
464 QPointF Curve::positionScreen (const QString &pointIdentifier) const
465 {
466  QPointF posScreen;
467 
468  // Search for point with matching identifier
469  Points::const_iterator itr;
470  for (itr = m_points.begin (); itr != m_points.end (); itr++) {
471  const Point &point = *itr;
472  if (pointIdentifier == point.identifier ()) {
473  posScreen = point.posScreen ();
474  break;
475  }
476  }
477 
478  return posScreen;
479 }
480 
481 void Curve::printStream (QString indentation,
482  QTextStream &str) const
483 {
484  str << indentation << "Curve=" << m_curveName << "\n";
485 
486  indentation += INDENTATION_DELTA;
487 
488  Points::const_iterator itr;
489  for (itr = m_points.begin (); itr != m_points.end (); itr++) {
490  const Point &point = *itr;
491  point.printStream (indentation,
492  str);
493  }
494 
495  m_colorFilterSettings.printStream (indentation,
496  str);
497  m_curveStyle.printStream (indentation,
498  str);
499 }
500 
501 void Curve::removePoint (const QString &identifier)
502 {
503  // Search for point with matching identifier
504  Points::iterator itr;
505  for (itr = m_points.begin (); itr != m_points.end (); itr++) {
506  Point point = *itr;
507  if (point.identifier () == identifier) {
508  m_points.erase (itr);
509  break;
510  }
511  }
512 }
513 
514 void Curve::saveXml(QXmlStreamWriter &writer) const
515 {
516  LOG4CPP_INFO_S ((*mainCat)) << "Curve::saveXml";
517 
518  writer.writeStartElement(DOCUMENT_SERIALIZE_CURVE);
519  writer.writeAttribute(DOCUMENT_SERIALIZE_CURVE_NAME, m_curveName);
520  m_colorFilterSettings.saveXml (writer,
521  m_curveName);
522  m_curveStyle.saveXml (writer,
523  m_curveName);
524 
525  // Loop through points
526  writer.writeStartElement(DOCUMENT_SERIALIZE_CURVE_POINTS);
527  Points::const_iterator itr;
528  for (itr = m_points.begin (); itr != m_points.end (); itr++) {
529  const Point &point = *itr;
530  point.saveXml (writer);
531  }
532  writer.writeEndElement();
533 
534  writer.writeEndElement();
535 }
536 
537 void Curve::setColorFilterSettings (const ColorFilterSettings &colorFilterSettings)
538 {
539  m_colorFilterSettings = colorFilterSettings;
540 }
541 
542 void Curve::setCurveName (const QString &curveName)
543 {
544  m_curveName = curveName;
545 
546  // Pass to member objects
547  QList<Point>::iterator itr;
548  for (itr = m_points.begin(); itr != m_points.end(); itr++) {
549  Point &point = *itr;
550  point.setCurveName (curveName);
551  }
552 }
553 
554 void Curve::setCurveStyle (const CurveStyle &curveStyle)
555 {
556  m_curveStyle = curveStyle;
557 }
558 
559 void Curve::updatePointOrdinals (const Transformation &transformation)
560 {
561  CurveConnectAs curveConnectAs = m_curveStyle.lineStyle().curveConnectAs();
562 
563  LOG4CPP_INFO_S ((*mainCat)) << "Curve::updatePointOrdinals"
564  << " curve=" << m_curveName.toLatin1().data()
565  << " connectAs=" << curveConnectAsToString(curveConnectAs).toLatin1().data();
566 
567  // Make sure ordinals are properly ordered. Sorting is done afterward
568 
569  if (curveConnectAs == CONNECT_AS_FUNCTION_SMOOTH ||
570  curveConnectAs == CONNECT_AS_FUNCTION_STRAIGHT) {
571 
572  updatePointOrdinalsFunctions (transformation);
573 
574  } else if (curveConnectAs == CONNECT_AS_RELATION_SMOOTH ||
575  curveConnectAs == CONNECT_AS_RELATION_STRAIGHT) {
576 
577  updatePointOrdinalsRelations ();
578 
579  } else {
580 
581  LOG4CPP_ERROR_S ((*mainCat)) << "Curve::updatePointOrdinals";
582  ENGAUGE_ASSERT (false);
583 
584  }
585 
586  qSort (m_points.begin(),
587  m_points.end(),
588  PointComparator());
589 }
590 
591 void Curve::updatePointOrdinalsFunctions (const Transformation &transformation)
592 {
593  CurveConnectAs curveConnectAs = m_curveStyle.lineStyle().curveConnectAs();
594 
595  LOG4CPP_INFO_S ((*mainCat)) << "Curve::updatePointOrdinalsFunctions"
596  << " curve=" << m_curveName.toLatin1().data()
597  << " connectAs=" << curveConnectAsToString(curveConnectAs).toLatin1().data();
598 
599  // Get a map of x/theta values as keys with point identifiers as the values
600  XOrThetaToPointIdentifier xOrThetaToPointIdentifier;
601  Points::iterator itr;
602  for (itr = m_points.begin (); itr != m_points.end (); itr++) {
603  Point &point = *itr;
604 
605  QPointF posGraph;
606  if (transformation.transformIsDefined()) {
607 
608  // Transformation is available so use it
609  transformation.transformScreenToRawGraph (point.posScreen (),
610  posGraph);
611  } else {
612 
613  // Transformation is not available so we just use the screen coordinates. Effectively, the
614  // transformation is the identity matrix
615  posGraph= point.posScreen();
616  }
617 
618  xOrThetaToPointIdentifier [posGraph.x()] = point.identifier();
619  }
620 
621  // Since m_points is a list (and therefore does not provide direct access to elements), we build a temporary map of
622  // point identifier to ordinal, by looping through the sorted x/theta values. Since QMap is used, the x/theta keys are sorted
623  QMap<QString, double> pointIdentifierToOrdinal;
624  int ordinal = 0;
625  XOrThetaToPointIdentifier::const_iterator itrX;
626  for (itrX = xOrThetaToPointIdentifier.begin(); itrX != xOrThetaToPointIdentifier.end(); itrX++) {
627 
628  QString pointIdentifier = itrX.value();
629  pointIdentifierToOrdinal [pointIdentifier] = ordinal++;
630  }
631 
632  // Override the old ordinal values
633  for (itr = m_points.begin(); itr != m_points.end(); itr++) {
634  Point &point = *itr;
635  int ordinalNew = pointIdentifierToOrdinal [point.identifier()];
636  point.setOrdinal (ordinalNew);
637  }
638 }
639 
640 void Curve::updatePointOrdinalsRelations ()
641 {
642  CurveConnectAs curveConnectAs = m_curveStyle.lineStyle().curveConnectAs();
643 
644  LOG4CPP_INFO_S ((*mainCat)) << "Curve::updatePointOrdinalsRelations"
645  << " curve=" << m_curveName.toLatin1().data()
646  << " connectAs=" << curveConnectAsToString(curveConnectAs).toLatin1().data();
647 
648  // Keep the ordinal numbering, but make sure the ordinals are evenly spaced
649  Points::iterator itr;
650  int ordinal = 0;
651  for (itr = m_points.begin(); itr != m_points.end(); itr++) {
652  Point &point = *itr;
653  point.setOrdinal (ordinal++);
654  }
655 }
void transformScreenToRawGraph(const QPointF &coordScreen, QPointF &coordGraph) const
Transform from cartesian pixel screen coordinates to cartesian/polar graph coordinates.
void removePoint(const QString &identifier)
Perform the opposite of addPointAtEnd.
Definition: Curve.cpp:501
QPointF positionScreen(const QString &pointIdentifier) const
Return the position, in screen coordinates, of the specified Point.
Definition: Curve.cpp:464
QPointF posGraph(ApplyHasCheck applyHasCheck=KEEP_HAS_CHECK) const
Accessor for graph position. Skip check if copying one instance to another.
Definition: Point.cpp:383
Comparator for sorting Point class.
void saveXml(QXmlStreamWriter &writer, const QString &curveName) const
Serialize to xml.
Definition: CurveStyle.cpp:93
Color filter parameters for one curve. For a class, this is handled the same as LineStyle and PointSt...
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:210
const Points points() const
Return a shallow copy of the Points.
Definition: Curve.cpp:442
void setCurveStyle(const CurveStyle &curveStyle)
Set curve style.
Definition: Curve.cpp:554
void printStream(QString indentation, QTextStream &str) const
Debugging method that supports print method of this class and printStream method of some other class(...
Definition: CurveStyle.cpp:80
void addPoint(Point point)
Add Point to this Curve.
Definition: Curve.cpp:124
void setColorFilterSettings(const ColorFilterSettings &colorFilterSettings)
Set color filter.
Definition: Curve.cpp:537
void saveXml(QXmlStreamWriter &writer) const
Serialize to stream.
Definition: Point.cpp:420
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.
Definition: Curve.cpp:423
void updatePointOrdinals(const Transformation &transformation)
See CurveGraphs::updatePointOrdinals.
Definition: Curve.cpp:559
LineStyle lineStyle() const
Get method for LineStyle.
Definition: CurveStyle.cpp:26
void setPointShape(PointShape shape)
Set method for curve point shape in specified curve.
Definition: CurveStyle.cpp:140
void editPointAxis(const QPointF &posGraph, const QString &identifier)
Edit the graph coordinates of an axis point. This method does not apply to a graph point...
Definition: Curve.cpp:144
bool isXOnly(const QString &pointIdentifier) const
Determine if specified point has just x coordinate. Otherwise has just y coordinate, or both x and y coordinates.
Definition: Curve.cpp:275
void addGraphCurveAtEnd(Curve curve)
Append new graph Curve to end of Curve list.
Class that represents one digitized point. The screen-to-graph coordinate transformation is always ex...
Definition: Point.h:23
static LineStyle defaultAxesCurve()
Initial default for axes curve.
Definition: LineStyle.cpp:68
QPointF posScreen() const
Accessor for screen position.
Definition: Point.cpp:392
void setLineConnectAs(CurveConnectAs curveConnectAs)
Set method for connect as method for lines in specified curve.
Definition: CurveStyle.cpp:110
QPointF positionGraph(const QString &pointIdentifier) const
Return the position, in graph coordinates, of the specified Point.
Definition: Curve.cpp:447
void setLineStyle(const LineStyle &lineStyle)
Set method for LineStyle.
Definition: CurveStyle.cpp:115
Curve(const QString &curveName, const ColorFilterSettings &colorFilterSettings, const CurveStyle &curveStyle)
Constructor from scratch.
Definition: Curve.cpp:32
void setPosGraph(const QPointF &posGraph)
Set method for position in graph coordinates.
Definition: Point.cpp:478
void printStream(QString indentation, QTextStream &str) const
Debugging method that supports print method of this class and printStream method of some other class(...
Definition: Curve.cpp:481
ColorPalette colorPalette(int preVersion6) const
Color from color palette.
Curve & operator=(const Curve &curve)
Assignment constructor.
Definition: Curve.cpp:114
CallbackSearchReturn
Return values for search callback methods.
QString identifier() const
Unique identifier for a specific Point.
Definition: Point.cpp:256
Converts old (=pre version 6) enums to new (=version 6) enums, for reading of old document files...
PointShape pointShape(int preVersion6) const
Point shape.
void saveXml(QXmlStreamWriter &writer, const QString &curveName) const
Save curve filter to stream.
void movePoint(const QString &pointIdentifier, const QPointF &deltaScreen)
Translate the position of a point by the specified distance vector.
Definition: Curve.cpp:414
void setPointRadius(int radius)
Set method for curve point radius.
Definition: CurveStyle.cpp:135
void setPointLineWidth(int width)
Set method for curve point perimeter line width.
Definition: CurveStyle.cpp:130
static ColorFilterSettings defaultFilter()
Initial default for any Curve.
Affine transformation between screen and graph coordinates, based on digitized axis points...
QString loadXml(QXmlStreamReader &reader)
Load from serialized xml. Returns the curve name.
Definition: CurveStyle.cpp:31
Container for all graph curves. The axes point curve is external to this class.
Definition: CurvesGraphs.h:24
bool isXOnly() const
In DOCUMENT_AXES_POINTS_REQUIRED_4 modes, this is true/false if y/x coordinate is undefined...
Definition: Point.cpp:274
void iterateThroughCurvePoints(const Functor2wRet< const QString &, const Point &, CallbackSearchReturn > &ftorWithCallback) const
Apply functor to Points on Curve.
Definition: Curve.cpp:292
void printStream(QString indentation, QTextStream &str) const
Debugging method that supports print method of this class and printStream method of some other class(...
Definition: Point.cpp:397
void setCurveName(const QString &curveName)
Change the curve name.
Definition: Curve.cpp:542
Container for LineStyle and PointStyle for one Curve.
Definition: CurveStyle.h:18
void setPosScreen(const QPointF &posScreen)
Set method for position in screen coordinates.
Definition: Point.cpp:492
Container for one set of digitized Points.
Definition: Curve.h:32
void editPointGraph(bool isX, bool isY, double x, double y, const QStringList &identifiers, const Transformation &transformation)
Edit the graph coordinates of one or more graph points. This method does not apply to an axis point...
Definition: Curve.cpp:161
void setLineColor(ColorPalette lineColor)
Set method for line color in specified curve.
Definition: CurveStyle.cpp:105
bool transformIsDefined() const
Transform is defined when at least three axis points have been digitized.
void loadXml(QXmlStreamReader &reader)
Load curve filter to stream.
void setPointColor(ColorPalette curveColor)
Set method curve point color in specified curve.
Definition: CurveStyle.cpp:125
Immediately terminate the current search.
CurveStyle curveStyle() const
Return the curve style.
Definition: Curve.cpp:139
CurveConnectAs curveConnectAs() const
Get method for connect type.
Definition: LineStyle.cpp:63
void printStream(QString indentation, QTextStream &str) const
Debugging method that supports print method of this class and printStream method of some other class(...
void setLineWidth(int width)
Set method for line width in specified curve.
Definition: CurveStyle.cpp:120
void setPointStyle(const PointStyle &pointStyle)
Set method for PointStyle.
Definition: CurveStyle.cpp:145
void transformRawGraphToScreen(const QPointF &pointRaw, QPointF &pointScreen) const
Transform from raw graph coordinates to linear cartesian graph coordinates, then to screen coordinate...
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...
Definition: Curve.cpp:307
void saveXml(QXmlStreamWriter &writer) const
Serialize curve.
Definition: Curve.cpp:514
void setOrdinal(double ordinal)
Set the ordinal used for ordering Points.
Definition: Point.cpp:468
static PointStyle defaultGraphCurve(int index)
Initial default for index&#39;th graph curve.
Definition: PointStyle.cpp:83
CurveConnectAs curveConnectAs(int preVersion6) const
Line drawn between points.
void setCurveName(const QString &curveName)
Update the point identifer to match the specified curve name.
Definition: Point.cpp:453
ColorFilterSettings colorFilterSettings() const
Return the color filter.
Definition: Curve.cpp:129
QString curveName() const
Name of this Curve.
Definition: Curve.cpp:134