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