Engauge Digitizer  2
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::editPoint (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::exportToClipboard (const QHash<QString, bool> &selectedHash,
162  const Transformation &transformation,
163  QTextStream &strCsv,
164  QTextStream &strHtml,
165  CurvesGraphs &curvesGraphs) const
166 {
167  LOG4CPP_INFO_S ((*mainCat)) << "Curve::exportToClipboard"
168  << " hashCount=" << selectedHash.count();
169 
170  // This method assumes Copy is only allowed when Transformation is valid
171 
172  bool isFirst = true;
173  QList<Point>::const_iterator itr;
174  for (itr = m_points.begin (); itr != m_points.end (); itr++) {
175 
176  const Point &point = *itr;
177  if (selectedHash.contains (point.identifier ())) {
178 
179  if (isFirst) {
180 
181  // Insert headers to identify the points that follow
182  isFirst = false;
183  strCsv << "X" << TAB_DELIMITER << m_curveName << "\n";
184  strHtml << "<table>\n"
185  << "<tr><th>X</th><th>" << m_curveName << "</th></tr>\n";
186  }
187 
188  // Default curve style
189  CurveStyle curveStyleDefault;
190  curveStyleDefault.setLineStyle(LineStyle::defaultAxesCurve());
191  curveStyleDefault.setPointStyle(PointStyle::defaultGraphCurve (curvesGraphs.numCurves ()));
192 
193  // Check if this curve already exists from a previously exported point
194  if (curvesGraphs.curveForCurveName (m_curveName) == 0) {
195  Curve curve(m_curveName,
197  curveStyleDefault);
198  curvesGraphs.addGraphCurveAtEnd(curve);
199  }
200 
201  // Start with screen coordinates
202  QPointF pos = point.posScreen();
203  if (transformation.transformIsDefined()) {
204 
205  // Replace with graph coordinates which are almost always more useful
206  QPointF posGraph;
207  transformation.transformScreenToRawGraph(pos,
208  posGraph);
209  pos = posGraph;
210  }
211 
212  // Add point to text going to clipboard
213  strCsv << pos.x() << TAB_DELIMITER << pos.y() << "\n";
214  strHtml << "<tr><td>" << pos.x() << "</td><td>" << pos.y() << "</td></tr>\n";
215 
216  // Add point to list for undo/redo
217  curvesGraphs.curveForCurveName (m_curveName)->addPoint (point);
218  }
219  }
220 
221  if (!isFirst) {
222  strHtml << "</table>\n";
223  }
224 }
225 
226 bool Curve::isXOnly(const QString &pointIdentifier) const
227 {
228  // Search for point with matching identifier
229  Points::const_iterator itr;
230  for (itr = m_points.begin (); itr != m_points.end (); itr++) {
231  const Point &point = *itr;
232  if (pointIdentifier == point.identifier ()) {
233  return point.isXOnly();
234  break;
235  }
236  }
237 
238  ENGAUGE_ASSERT (false);
239 
240  return false;
241 }
242 
243 void Curve::iterateThroughCurvePoints (const Functor2wRet<const QString &, const Point&, CallbackSearchReturn> &ftorWithCallback) const
244 {
245  QList<Point>::const_iterator itr;
246  for (itr = m_points.begin (); itr != m_points.end (); itr++) {
247 
248  const Point &point = *itr;
249 
250  CallbackSearchReturn rtn = ftorWithCallback (m_curveName, point);
251 
253  break;
254  }
255  }
256 }
257 
258 void Curve::iterateThroughCurveSegments (const Functor2wRet<const Point&, const Point&, CallbackSearchReturn> &ftorWithCallback) const
259 {
260  // Loop through Points. They are assumed to be already sorted by their ordinals, but we do NOT
261  // check the ordinal ordering since this could be called before, or while, the ordinal sorting is done
262  QList<Point>::const_iterator itr;
263  const Point *pointBefore = 0;
264  for (itr = m_points.begin(); itr != m_points.end(); itr++) {
265 
266  const Point &point = *itr;
267 
268  if (pointBefore != 0) {
269 
270  CallbackSearchReturn rtn = ftorWithCallback (*pointBefore,
271  point);
272 
274  break;
275  }
276 
277  }
278  pointBefore = &point;
279  }
280 }
281 
282 void Curve::loadCurvePoints(QXmlStreamReader &reader)
283 {
284  LOG4CPP_INFO_S ((*mainCat)) << "Curve::loadCurvePoints";
285 
286  bool success = true;
287 
288  while ((reader.tokenType() != QXmlStreamReader::EndElement) ||
289  (reader.name() != DOCUMENT_SERIALIZE_CURVE_POINTS)) {
290 
291  QXmlStreamReader::TokenType tokenType = loadNextFromReader(reader);
292 
293  if (reader.atEnd()) {
294  success = false;
295  break;
296  }
297 
298  if (tokenType == QXmlStreamReader::StartElement) {
299 
300  if (reader.name () == DOCUMENT_SERIALIZE_POINT) {
301 
302  Point point (reader);
303  m_points.push_back (point);
304  }
305  }
306  }
307 
308  if (!success) {
309  reader.raiseError(QObject::tr ("Cannot read curve data"));
310  }
311 }
312 
313 void Curve::loadXml(QXmlStreamReader &reader)
314 {
315  LOG4CPP_INFO_S ((*mainCat)) << "Curve::loadXml";
316 
317  bool success = true;
318 
319  QXmlStreamAttributes attributes = reader.attributes();
320 
321  if (attributes.hasAttribute (DOCUMENT_SERIALIZE_CURVE_NAME)) {
322 
323  setCurveName (attributes.value (DOCUMENT_SERIALIZE_CURVE_NAME).toString());
324 
325  // Read until end of this subtree
326  while ((reader.tokenType() != QXmlStreamReader::EndElement) ||
327  (reader.name() != DOCUMENT_SERIALIZE_CURVE)){
328 
329  QXmlStreamReader::TokenType tokenType = loadNextFromReader(reader);
330 
331  if (reader.atEnd()) {
332  success = false;
333  break;
334  }
335 
336  if (tokenType == QXmlStreamReader::StartElement) {
337 
338  if (reader.name() == DOCUMENT_SERIALIZE_COLOR_FILTER) {
339  m_colorFilterSettings.loadXml(reader);
340  } else if (reader.name() == DOCUMENT_SERIALIZE_CURVE_POINTS) {
341  loadCurvePoints(reader);
342  } else if (reader.name() == DOCUMENT_SERIALIZE_CURVE_STYLE) {
343  m_curveStyle.loadXml(reader);
344  } else {
345  success = false;
346  break;
347  }
348  }
349 
350  if (reader.hasError()) {
351  // No need to set success flag to indicate failure, which raises the error, since the error was already raised. Just
352  // need to exit the loop immediately
353  break;
354  }
355  }
356  } else {
357  success = false;
358  }
359 
360  if (!success) {
361  reader.raiseError (QObject::tr ("Cannot read curve data"));
362  }
363 }
364 
365 void Curve::movePoint (const QString &pointIdentifier,
366  const QPointF &deltaScreen)
367 {
368  Point *point = pointForPointIdentifier (pointIdentifier);
369 
370  QPointF posScreen = deltaScreen + point->posScreen ();
371  point->setPosScreen (posScreen);
372 }
373 
374 int Curve::numPoints () const
375 {
376  return m_points.count ();
377 }
378 
379 Point *Curve::pointForPointIdentifier (const QString pointIdentifier)
380 {
381  Points::iterator itr;
382  for (itr = m_points.begin (); itr != m_points.end (); itr++) {
383  Point &point = *itr;
384  if (pointIdentifier == point.identifier ()) {
385  return &point;
386  }
387  }
388 
389  ENGAUGE_ASSERT (false);
390  return 0;
391 }
392 
393 const Points Curve::points () const
394 {
395  return m_points;
396 }
397 
398 QPointF Curve::positionGraph (const QString &pointIdentifier) const
399 {
400  QPointF posGraph;
401 
402  // Search for point with matching identifier
403  Points::const_iterator itr;
404  for (itr = m_points.begin (); itr != m_points.end (); itr++) {
405  const Point &point = *itr;
406  if (pointIdentifier == point.identifier ()) {
407  posGraph = point.posGraph ();
408  break;
409  }
410  }
411 
412  return posGraph;
413 }
414 
415 QPointF Curve::positionScreen (const QString &pointIdentifier) const
416 {
417  QPointF posScreen;
418 
419  // Search for point with matching identifier
420  Points::const_iterator itr;
421  for (itr = m_points.begin (); itr != m_points.end (); itr++) {
422  const Point &point = *itr;
423  if (pointIdentifier == point.identifier ()) {
424  posScreen = point.posScreen ();
425  break;
426  }
427  }
428 
429  return posScreen;
430 }
431 
432 void Curve::printStream (QString indentation,
433  QTextStream &str) const
434 {
435  str << indentation << "Curve=" << m_curveName << "\n";
436 
437  indentation += INDENTATION_DELTA;
438 
439  Points::const_iterator itr;
440  for (itr = m_points.begin (); itr != m_points.end (); itr++) {
441  const Point &point = *itr;
442  point.printStream (indentation,
443  str);
444  }
445 
446  m_colorFilterSettings.printStream (indentation,
447  str);
448  m_curveStyle.printStream (indentation,
449  str);
450 }
451 
452 void Curve::removePoint (const QString &identifier)
453 {
454  // Search for point with matching identifier
455  Points::iterator itr;
456  for (itr = m_points.begin (); itr != m_points.end (); itr++) {
457  Point point = *itr;
458  if (point.identifier () == identifier) {
459  m_points.erase (itr);
460  break;
461  }
462  }
463 }
464 
465 void Curve::saveXml(QXmlStreamWriter &writer) const
466 {
467  LOG4CPP_INFO_S ((*mainCat)) << "Curve::saveXml";
468 
469  writer.writeStartElement(DOCUMENT_SERIALIZE_CURVE);
470  writer.writeAttribute(DOCUMENT_SERIALIZE_CURVE_NAME, m_curveName);
471  m_colorFilterSettings.saveXml (writer,
472  m_curveName);
473  m_curveStyle.saveXml (writer,
474  m_curveName);
475 
476  // Loop through points
477  writer.writeStartElement(DOCUMENT_SERIALIZE_CURVE_POINTS);
478  Points::const_iterator itr;
479  for (itr = m_points.begin (); itr != m_points.end (); itr++) {
480  const Point &point = *itr;
481  point.saveXml (writer);
482  }
483  writer.writeEndElement();
484 
485  writer.writeEndElement();
486 }
487 
489 {
490  m_colorFilterSettings = colorFilterSettings;
491 }
492 
493 void Curve::setCurveName (const QString &curveName)
494 {
495  m_curveName = curveName;
496 
497  // Pass to member objects
498  QList<Point>::iterator itr;
499  for (itr = m_points.begin(); itr != m_points.end(); itr++) {
500  Point &point = *itr;
501  point.setCurveName (curveName);
502  }
503 }
504 
506 {
507  m_curveStyle = curveStyle;
508 }
509 
510 void Curve::updatePointOrdinals (const Transformation &transformation)
511 {
512  CurveConnectAs curveConnectAs = m_curveStyle.lineStyle().curveConnectAs();
513 
514  LOG4CPP_INFO_S ((*mainCat)) << "Curve::updatePointOrdinals"
515  << " curve=" << m_curveName.toLatin1().data()
516  << " connectAs=" << curveConnectAsToString(curveConnectAs).toLatin1().data();
517 
518  // Make sure ordinals are properly ordered. Sorting is done afterward
519 
520  if (curveConnectAs == CONNECT_AS_FUNCTION_SMOOTH ||
521  curveConnectAs == CONNECT_AS_FUNCTION_STRAIGHT) {
522 
523  updatePointOrdinalsFunctions (transformation);
524 
525  } else if (curveConnectAs == CONNECT_AS_RELATION_SMOOTH ||
526  curveConnectAs == CONNECT_AS_RELATION_STRAIGHT) {
527 
528  updatePointOrdinalsRelations ();
529 
530  } else {
531 
532  LOG4CPP_ERROR_S ((*mainCat)) << "Curve::updatePointOrdinals";
533  ENGAUGE_ASSERT (false);
534 
535  }
536 
537  qSort (m_points.begin(),
538  m_points.end(),
539  PointComparator());
540 }
541 
542 void Curve::updatePointOrdinalsFunctions (const Transformation &transformation)
543 {
544  CurveConnectAs curveConnectAs = m_curveStyle.lineStyle().curveConnectAs();
545 
546  LOG4CPP_INFO_S ((*mainCat)) << "Curve::updatePointOrdinalsFunctions"
547  << " curve=" << m_curveName.toLatin1().data()
548  << " connectAs=" << curveConnectAsToString(curveConnectAs).toLatin1().data();
549 
550  // Get a map of x/theta values as keys with point identifiers as the values
551  XOrThetaToPointIdentifier xOrThetaToPointIdentifier;
552  Points::iterator itr;
553  for (itr = m_points.begin (); itr != m_points.end (); itr++) {
554  Point &point = *itr;
555 
556  QPointF posGraph;
557  if (transformation.transformIsDefined()) {
558 
559  // Transformation is available so use it
560  transformation.transformScreenToRawGraph (point.posScreen (),
561  posGraph);
562  } else {
563 
564  // Transformation is not available so we just use the screen coordinates. Effectively, the
565  // transformation is the identity matrix
566  posGraph= point.posScreen();
567  }
568 
569  xOrThetaToPointIdentifier [posGraph.x()] = point.identifier();
570  }
571 
572  // Since m_points is a list (and therefore does not provide direct access to elements), we build a temporary map of
573  // point identifier to ordinal, by looping through the sorted x/theta values. Since QMap is used, the x/theta keys are sorted
574  QMap<QString, double> pointIdentifierToOrdinal;
575  int ordinal = 0;
576  XOrThetaToPointIdentifier::const_iterator itrX;
577  for (itrX = xOrThetaToPointIdentifier.begin(); itrX != xOrThetaToPointIdentifier.end(); itrX++) {
578 
579  QString pointIdentifier = itrX.value();
580  pointIdentifierToOrdinal [pointIdentifier] = ordinal++;
581  }
582 
583  // Override the old ordinal values
584  for (itr = m_points.begin(); itr != m_points.end(); itr++) {
585  Point &point = *itr;
586  int ordinalNew = pointIdentifierToOrdinal [point.identifier()];
587  point.setOrdinal (ordinalNew);
588  }
589 }
590 
591 void Curve::updatePointOrdinalsRelations ()
592 {
593  CurveConnectAs curveConnectAs = m_curveStyle.lineStyle().curveConnectAs();
594 
595  LOG4CPP_INFO_S ((*mainCat)) << "Curve::updatePointOrdinalsRelations"
596  << " curve=" << m_curveName.toLatin1().data()
597  << " connectAs=" << curveConnectAsToString(curveConnectAs).toLatin1().data();
598 
599  // Keep the ordinal numbering, but make sure the ordinals are evenly spaced
600  Points::iterator itr;
601  int ordinal = 0;
602  for (itr = m_points.begin(); itr != m_points.end(); itr++) {
603  Point &point = *itr;
604  point.setOrdinal (ordinal++);
605  }
606 }
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:452
QPointF positionScreen(const QString &pointIdentifier) const
Return the position, in screen coordinates, of the specified Point.
Definition: Curve.cpp:415
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:161
const Points points() const
Return a shallow copy of the Points.
Definition: Curve.cpp:393
void setCurveStyle(const CurveStyle &curveStyle)
Set curve style.
Definition: Curve.cpp:505
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:488
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:374
void updatePointOrdinals(const Transformation &transformation)
See CurveGraphs::updatePointOrdinals.
Definition: Curve.cpp:510
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
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:226
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:398
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:432
ColorPalette colorPalette(int preVersion6) const
Color from color palette.
void editPoint(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
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:365
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:243
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:493
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 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 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:258
void saveXml(QXmlStreamWriter &writer) const
Serialize curve.
Definition: Curve.cpp:465
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