Engauge Digitizer  2
CoordSystem.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 "CallbackAddPointsInCurvesGraphs.h"
8 #include "CallbackCheckAddPointAxis.h"
9 #include "CallbackCheckEditPointAxis.h"
10 #include "CallbackNextOrdinal.h"
11 #include "CallbackRemovePointsInCurvesGraphs.h"
12 #include "CoordSystem.h"
13 #include "Curve.h"
14 #include "CurvesGraphs.h"
15 #include "CurveStyles.h"
16 #include "DocumentSerialize.h"
17 #include "EngaugeAssert.h"
18 #include "EnumsToQt.h"
19 #include <iostream>
20 #include "Logger.h"
21 #include "OrdinalGenerator.h"
22 #include "Point.h"
23 #include <QByteArray>
24 #include <QDataStream>
25 #include <QDebug>
26 #include <QFile>
27 #include <QImage>
28 #include <QtToString.h>
29 #include <QXmlStreamReader>
30 #include <QXmlStreamWriter>
31 #include "SettingsForGraph.h"
32 #include "Transformation.h"
33 #include "Version.h"
34 #include "Xml.h"
35 
36 const int FOUR_BYTES = 4;
37 
38 CoordSystem::CoordSystem (DocumentAxesPointsRequired documentAxesPointsRequired) :
39  m_curveAxes (new Curve (AXIS_CURVE_NAME,
40  ColorFilterSettings::defaultFilter (),
41  CurveStyle (LineStyle::defaultAxesCurve(),
42  PointStyle::defaultAxesCurve ()))),
43  m_documentAxesPointsRequired (documentAxesPointsRequired)
44 {
45  LOG4CPP_INFO_S ((*mainCat)) << "CoordSystem::CoordSystem";
46 
47  SettingsForGraph settingsForGraph;
48  QString curveName = settingsForGraph.defaultCurveName (1,
49  DEFAULT_GRAPH_CURVE_NAME);
50  m_curvesGraphs.addGraphCurveAtEnd (Curve (curveName,
53  PointStyle::defaultGraphCurve (m_curvesGraphs.numCurves ()))));
54 
55  resetSelectedCurveNameIfNecessary ();
56 }
57 
58 void CoordSystem::addGraphCurveAtEnd (const QString &curveName)
59 {
60  m_curvesGraphs.addGraphCurveAtEnd (Curve (curveName,
63  PointStyle::defaultGraphCurve(m_curvesGraphs.numCurves()))));
64 
65  resetSelectedCurveNameIfNecessary ();
66 }
67 
68 void CoordSystem::addPointAxisWithGeneratedIdentifier (const QPointF &posScreen,
69  const QPointF &posGraph,
70  QString &identifier,
71  double ordinal,
72  bool isXOnly)
73 {
74  Point point (AXIS_CURVE_NAME,
75  posScreen,
76  posGraph,
77  ordinal,
78  isXOnly);
79  m_curveAxes->addPoint (point);
80 
81  identifier = point.identifier();
82 
83  LOG4CPP_INFO_S ((*mainCat)) << "CoordSystem::addPointAxisWithGeneratedIdentifier"
84  << " ordinal=" << ordinal
85  << " posScreen=" << QPointFToString (posScreen).toLatin1 ().data ()
86  << " posGraph=" << QPointFToString (posGraph).toLatin1 ().data ()
87  << " identifier=" << identifier.toLatin1 ().data ();
88 }
89 
90 void CoordSystem::addPointAxisWithSpecifiedIdentifier (const QPointF &posScreen,
91  const QPointF &posGraph,
92  const QString &identifier,
93  double ordinal,
94  bool isXOnly)
95 {
96  Point point (AXIS_CURVE_NAME,
97  identifier,
98  posScreen,
99  posGraph,
100  ordinal,
101  isXOnly);
102  m_curveAxes->addPoint (point);
103 
104  LOG4CPP_INFO_S ((*mainCat)) << "CoordSystem::addPointAxisWithSpecifiedIdentifier"
105  << " ordinal=" << ordinal
106  << " posScreen=" << QPointFToString (posScreen).toLatin1 ().data ()
107  << " posGraph=" << QPointFToString (posGraph).toLatin1 ().data ()
108  << " identifier=" << identifier.toLatin1 ().data ();
109 }
110 
112  const QPointF &posScreen,
113  QString &identifier,
114  double ordinal)
115 {
116  Point point (curveName,
117  posScreen,
118  ordinal);
119  m_curvesGraphs.addPoint (point);
120 
121  identifier = point.identifier();
122 
123  LOG4CPP_INFO_S ((*mainCat)) << "CoordSystem::addPointGraphWithGeneratedIdentifier"
124  << " ordinal=" << ordinal
125  << " posScreen=" << QPointFToString (posScreen).toLatin1 ().data ()
126  << " identifier=" << identifier.toLatin1 ().data ();
127 }
128 
130  const QPointF &posScreen,
131  const QString &identifier,
132  double ordinal)
133 {
134  Point point (curveName,
135  identifier,
136  posScreen,
137  ordinal);
138  m_curvesGraphs.addPoint (point);
139 
140  LOG4CPP_INFO_S ((*mainCat)) << "CoordSystem::addPointGraphWithSpecifiedIdentifier"
141  << " ordinal=" << ordinal
142  << " posScreen=" << QPointFToString (posScreen).toLatin1 ().data ()
143  << " identifier=" << identifier.toLatin1 ().data ();
144 }
145 
147 {
148  CallbackAddPointsInCurvesGraphs ftor (*this);
149 
150  Functor2wRet<const QString &, const Point &, CallbackSearchReturn> ftorWithCallback = functor_ret (ftor,
152 
153  curvesGraphs.iterateThroughCurvesPoints (ftorWithCallback);
154 }
155 
156 bool CoordSystem::bytesIndicatePreVersion6 (const QByteArray &bytes) const
157 {
158  QByteArray preVersion6MagicNumber;
159  preVersion6MagicNumber.resize (FOUR_BYTES);
160 
161  // Windows compiler gives warning if 0x## is used instead of '\x##' below
162  preVersion6MagicNumber[0] = '\x00';
163  preVersion6MagicNumber[1] = '\x00';
164  preVersion6MagicNumber[2] = '\xCA';
165  preVersion6MagicNumber[3] = '\xFE';
166 
167  return (bytes == preVersion6MagicNumber);
168 }
169 
170 void CoordSystem::checkAddPointAxis (const QPointF &posScreen,
171  const QPointF &posGraph,
172  bool &isError,
173  QString &errorMessage,
174  bool isXOnly)
175 {
176  LOG4CPP_INFO_S ((*mainCat)) << "CoordSystem::checkAddPointAxis"
177  << " posScreen=" << QPointFToString (posScreen).toLatin1 ().data ()
178  << " posGraph=" << QPointFToString (posGraph).toLatin1 ().data ();
179 
180  CallbackCheckAddPointAxis ftor (m_modelCoords,
181  posScreen,
182  posGraph,
183  m_documentAxesPointsRequired,
184  isXOnly);
185 
186  Functor2wRet<const QString &, const Point &, CallbackSearchReturn> ftorWithCallback = functor_ret (ftor,
188  m_curveAxes->iterateThroughCurvePoints (ftorWithCallback);
189 
190  isError = ftor.isError ();
191  errorMessage = ftor.errorMessage ();
192 }
193 
194 void CoordSystem::checkEditPointAxis (const QString &pointIdentifier,
195  const QPointF &posScreen,
196  const QPointF &posGraph,
197  bool &isError,
198  QString &errorMessage)
199 {
200  LOG4CPP_INFO_S ((*mainCat)) << "CoordSystem::checkEditPointAxis"
201  << " posGraph=" << QPointFToString (posGraph).toLatin1 ().data ();
202 
203  CallbackCheckEditPointAxis ftor (m_modelCoords,
204  pointIdentifier,
205  posScreen,
206  posGraph,
207  m_documentAxesPointsRequired);
208 
209  Functor2wRet<const QString &, const Point &, CallbackSearchReturn> ftorWithCallback = functor_ret (ftor,
211  m_curveAxes->iterateThroughCurvePoints (ftorWithCallback);
212 
213  isError = ftor.isError ();
214  errorMessage = ftor.errorMessage ();
215 }
216 
218 {
219  ENGAUGE_CHECK_PTR (m_curveAxes);
220 
221  return *m_curveAxes;
222 }
223 
224 Curve *CoordSystem::curveForCurveName (const QString &curveName)
225 {
226  if (curveName == AXIS_CURVE_NAME) {
227 
228  return m_curveAxes;
229 
230  } else {
231 
232  return m_curvesGraphs.curveForCurveName (curveName);
233 
234  }
235 }
236 
237 const Curve *CoordSystem::curveForCurveName (const QString &curveName) const
238 {
239  if (curveName == AXIS_CURVE_NAME) {
240 
241  return m_curveAxes;
242 
243  } else {
244 
245  return m_curvesGraphs.curveForCurveName (curveName);
246 
247  }
248 }
249 
251 {
252  return m_curvesGraphs;
253 }
254 
256 {
257  return m_curvesGraphs.curvesGraphsNames();
258 }
259 
260 int CoordSystem::curvesGraphsNumPoints(const QString &curveName) const
261 {
262  return m_curvesGraphs.curvesGraphsNumPoints(curveName);
263 }
264 
265 void CoordSystem::editPointAxis (const QPointF &posGraph,
266  const QString &identifier)
267 {
268  LOG4CPP_INFO_S ((*mainCat)) << "CoordSystem::editPointAxis"
269  << " posGraph=(" << posGraph.x () << ", " << posGraph.y () << ") identifier="
270  << " identifier=" << identifier.toLatin1 ().data ();
271 
272  m_curveAxes->editPointAxis (posGraph,
273  identifier);
274 }
275 
277  bool isY,
278  double x,
279  double y,
280  const QStringList &identifiers,
281  const Transformation &transformation)
282 {
283  LOG4CPP_INFO_S ((*mainCat)) << "CoordSystem::editPointGraph posGraph=("
284  << " x=" << (isX ? QString::number (x).toLatin1().data() : "")
285  << " y=" << (isY ? QString::number (y).toLatin1().data() : "")
286  << ") identifiers=" << identifiers.join(" ").toLatin1 ().data ();
287 
288  m_curvesGraphs.editPointGraph (isX,
289  isY,
290  x,
291  y,
292  identifiers,
293  transformation);
294 }
295 
296 bool CoordSystem::isXOnly (const QString &pointIdentifier) const
297 {
298  return m_curveAxes->isXOnly (pointIdentifier);
299 }
300 
301 void CoordSystem::iterateThroughCurvePointsAxes (const Functor2wRet<const QString &, const Point &, CallbackSearchReturn> &ftorWithCallback)
302 {
303  ENGAUGE_CHECK_PTR (m_curveAxes);
304 
305  m_curveAxes->iterateThroughCurvePoints (ftorWithCallback);
306 }
307 
308 void CoordSystem::iterateThroughCurvePointsAxes (const Functor2wRet<const QString &, const Point &, CallbackSearchReturn> &ftorWithCallback) const
309 {
310  ENGAUGE_CHECK_PTR (m_curveAxes);
311 
312  m_curveAxes->iterateThroughCurvePoints (ftorWithCallback);
313 }
314 
315 void CoordSystem::iterateThroughCurveSegments (const QString &curveName,
316  const Functor2wRet<const Point &, const Point &, CallbackSearchReturn> &ftorWithCallback) const
317 {
318  if (curveName == AXIS_CURVE_NAME) {
319  m_curveAxes->iterateThroughCurveSegments(ftorWithCallback);
320  } else {
321  m_curvesGraphs.iterateThroughCurveSegments(curveName,
322  ftorWithCallback);
323  }
324 }
325 
326 void CoordSystem::iterateThroughCurvesPointsGraphs (const Functor2wRet<const QString &, const Point &, CallbackSearchReturn> &ftorWithCallback)
327 {
328  ENGAUGE_CHECK_PTR (m_curveAxes);
329 
330  m_curvesGraphs.iterateThroughCurvesPoints (ftorWithCallback);
331 }
332 
333 void CoordSystem::iterateThroughCurvesPointsGraphs (const Functor2wRet<const QString &, const Point &, CallbackSearchReturn> &ftorWithCallback) const
334 {
335  ENGAUGE_CHECK_PTR (m_curveAxes);
336 
337  m_curvesGraphs.iterateThroughCurvesPoints (ftorWithCallback);
338 }
339 
340 bool CoordSystem::loadCurvesFile(const QString & /* curvesFile */)
341 {
342  LOG4CPP_INFO_S ((*mainCat)) << "CoordSystem::loadCurvesFile";
343 
344  return true;
345 }
346 
347 void CoordSystem::loadPreVersion6 (QDataStream &str,
348  double version)
349 {
350  LOG4CPP_INFO_S ((*mainCat)) << "CoordSystem::loadPreVersion6";
351 
352  qint32 int32;
353  double dbl, radius = 0.0;
354  QString st;
355 
356  m_documentAxesPointsRequired = DOCUMENT_AXES_POINTS_REQUIRED_3;
357 
358  str >> st; // CurveCmbText selection
359  str >> st; // MeasureCmbText selection
360  str >> int32;
361  m_modelCoords.setCoordsType((CoordsType) int32);
362  if (version >= 3) {
363  str >> (double &) radius;
364  }
365  m_modelCoords.setOriginRadius(radius);
366  str >> int32;
367  m_modelCoords.setCoordUnitsRadius(COORD_UNITS_NON_POLAR_THETA_NUMBER);
368  m_modelCoords.setCoordUnitsTheta((CoordUnitsPolarTheta) int32);
369  str >> int32;
370  m_modelCoords.setCoordScaleXTheta((CoordScale) int32);
371  str >> int32;
372  m_modelCoords.setCoordScaleYRadius((CoordScale) int32);
373 
374  str >> int32;
375  m_modelExport.setDelimiter((ExportDelimiter) int32);
376  str >> int32;
377  m_modelExport.setLayoutFunctions((ExportLayoutFunctions) int32);
378  str >> int32;
379  m_modelExport.setPointsSelectionFunctions((ExportPointsSelectionFunctions) int32);
380  m_modelExport.setPointsIntervalUnitsRelations((ExportPointsIntervalUnits) int32);
381  str >> int32;
382  m_modelExport.setHeader((ExportHeader) int32);
383  if (version >= 5.1) {
384  str >> st; // X label
385  if (m_modelCoords.coordsType() == COORDS_TYPE_CARTESIAN) {
386  m_modelExport.setXLabel(st);
387  }
388  str >> st; // Theta label
389  if (m_modelCoords.coordsType() == COORDS_TYPE_POLAR) {
390  m_modelExport.setXLabel(st);
391  }
392  }
393 
394  // Stable flag in m_modelGridRemoval is set below after points are read in
395  str >> int32; // Remove thin lines parallel to axes
396  str >> dbl; // Thin thickness
397  str >> int32;
398  m_modelGridRemoval.setRemoveDefinedGridLines(int32);
399  str >> int32; // Initialized
400  str >> int32;
401  m_modelGridRemoval.setCountX(int32);
402  str >> int32;
403  m_modelGridRemoval.setCountY(int32);
404  str >> int32;
405  m_modelGridRemoval.setGridCoordDisableX((GridCoordDisable) int32);
406  str >> int32;
407  m_modelGridRemoval.setGridCoordDisableY((GridCoordDisable) int32);
408  str >> dbl;
409  m_modelGridRemoval.setStartX(dbl);
410  str >> dbl;
411  m_modelGridRemoval.setStartY(dbl);
412  str >> dbl;
413  m_modelGridRemoval.setStepX(dbl);
414  str >> dbl;
415  m_modelGridRemoval.setStepY(dbl);
416  str >> dbl;
417  m_modelGridRemoval.setStopX(dbl);
418  str >> dbl;
419  m_modelGridRemoval.setStopY(dbl);
420  str >> dbl;
421  m_modelGridRemoval.setCloseDistance(dbl);
422  str >> int32; // Boolean remove color flag
423  if (version >= 5) {
424  QColor color;
425  str >> color;
426  } else {
427  str >> int32; // Rgb color
428  }
429  str >> int32; // Foreground threshold low
430  str >> int32; // Foreground threshold high
431  str >> dbl; // Gap separation
432 
433  str >> int32;
434  m_modelGridDisplay.setStable(int32);
435  str >> int32;
436  m_modelGridDisplay.setCountX(int32);
437  str >> int32;
438  m_modelGridDisplay.setCountY(int32);
439  str >> int32;
440  m_modelGridDisplay.setDisableX((GridCoordDisable) int32);
441  str >> int32;
442  m_modelGridDisplay.setDisableY((GridCoordDisable) int32);
443  str >> dbl;
444  m_modelGridDisplay.setStartX (dbl);
445  str >> dbl;
446  m_modelGridDisplay.setStartY (dbl);
447  str >> dbl;
448  m_modelGridDisplay.setStepX (dbl);
449  str >> dbl;
450  m_modelGridDisplay.setStepY (dbl);
451  str >> dbl;
452  m_modelGridDisplay.setStopX (dbl);
453  str >> dbl;
454  m_modelGridDisplay.setStopY (dbl);
455 
456  str >> int32;
457  m_modelSegments.setMinLength(int32);
458  str >> int32;
459  m_modelSegments.setPointSeparation(int32);
460  str >> int32;
461  m_modelSegments.setLineWidth(int32);
462  str >> int32;
463  m_modelSegments.setLineColor((ColorPalette) int32);
464 
465  str >> int32; // Point separation
466  str >> int32;
467  m_modelPointMatch.setMaxPointSize(int32);
468  str >> int32;
469  m_modelPointMatch.setPaletteColorAccepted((ColorPalette) int32);
470  str >> int32;
471  m_modelPointMatch.setPaletteColorRejected((ColorPalette) int32);
472  if (version < 4) {
473  m_modelPointMatch.setPaletteColorCandidate(COLOR_PALETTE_BLUE);
474  } else {
475  str >> int32;
476  m_modelPointMatch.setPaletteColorCandidate((ColorPalette) int32);
477  }
478 
479  str >> int32; // Discretize method
480  str >> int32; // Intensity threshold low
481  str >> int32; // Intensity threshold high
482  str >> int32; // Foreground threshold low
483  str >> int32; // Foreground threshold high
484  str >> int32; // Hue threshold low
485  str >> int32; // Hue threshold high
486  str >> int32; // Saturation threshold low
487  str >> int32; // Saturation threshold high
488  str >> int32; // Value threshold low
489  str >> int32; // Value threshold high
490 
491  m_curveAxes = new Curve (str);
492  Curve curveScale (str); // Scales are dropped on the floor
493  m_curvesGraphs.loadPreVersion6 (str);
494 
495  // Information from curves and points can affect some data structures that were (mostly) set earlier
496  if (m_curveAxes->numPoints () > 2) {
497  m_modelGridRemoval.setStable();
498  }
499 
500  resetSelectedCurveNameIfNecessary ();
501 }
502 
503 void CoordSystem::loadVersion6 (QXmlStreamReader &reader)
504 {
505  LOG4CPP_INFO_S ((*mainCat)) << "CoordSystem::loadVersion6";
506 
507  m_documentAxesPointsRequired = DOCUMENT_AXES_POINTS_REQUIRED_3;
508 
509  // Import from xml. Loop to end of data or error condition occurs, whichever is first
510  while (!reader.atEnd() &&
511  !reader.hasError()) {
512  QXmlStreamReader::TokenType tokenType = loadNextFromReader(reader);
513 
514  if ((reader.name() == DOCUMENT_SERIALIZE_DOCUMENT) &&
515  (tokenType == QXmlStreamReader::EndElement)) {
516 
517  // Exit out of loop immediately
518  break;
519  }
520 
521  // Iterate to next StartElement
522  if (tokenType == QXmlStreamReader::StartElement) {
523 
524  // This is a StartElement, so process it
525  QString tag = reader.name().toString();
526  if (tag == DOCUMENT_SERIALIZE_AXES_CHECKER){
527  m_modelAxesChecker.loadXml (reader);
528  } else if (tag == DOCUMENT_SERIALIZE_COORDS) {
529  m_modelCoords.loadXml (reader);
530  } else if (tag == DOCUMENT_SERIALIZE_CURVE) {
531  m_curveAxes = new Curve (reader);
532  } else if (tag == DOCUMENT_SERIALIZE_CURVES_GRAPHS) {
533  m_curvesGraphs.loadXml (reader);
534  } else if (tag == DOCUMENT_SERIALIZE_DIGITIZE_CURVE) {
535  m_modelDigitizeCurve.loadXml (reader);
536  } else if (tag == DOCUMENT_SERIALIZE_EXPORT) {
537  m_modelExport.loadXml (reader);
538  } else if (tag == DOCUMENT_SERIALIZE_GENERAL || tag == DOCUMENT_SERIALIZE_COMMON) {
539  m_modelGeneral.loadXml (reader);
540  } else if (tag == DOCUMENT_SERIALIZE_GRID_REMOVAL) {
541  m_modelGridRemoval.loadXml (reader);
542  } else if (tag == DOCUMENT_SERIALIZE_IMAGE) {
543  ENGAUGE_ASSERT (false); // The image should have been read before this method was called
544  } else if (tag == DOCUMENT_SERIALIZE_POINT_MATCH) {
545  m_modelPointMatch.loadXml (reader);
546  } else if (tag == DOCUMENT_SERIALIZE_SEGMENTS) {
547  m_modelSegments.loadXml (reader);
548  } else {
549  m_successfulRead = false;
550  m_reasonForUnsuccessfulRead = QString ("%1 '%2' %3")
551  .arg (QObject::tr ("Unexpected xml token"))
552  .arg (tag)
553  .arg ("encountered");
554  break;
555  }
556  }
557  }
558 
559  resetSelectedCurveNameIfNecessary ();
560 }
561 
562 void CoordSystem::loadVersions7AndUp (QXmlStreamReader &reader,
563  DocumentAxesPointsRequired documentAxesPointsRequired)
564 {
565  LOG4CPP_INFO_S ((*mainCat)) << "CoordSystem::loadVersions7AndUp";
566 
567  m_documentAxesPointsRequired = documentAxesPointsRequired;
568 
569  // Import from xml. Loop to end of data or error condition occurs, whichever is first
570  while (!reader.atEnd() &&
571  !reader.hasError()) {
572  QXmlStreamReader::TokenType tokenType = loadNextFromReader(reader);
573 
574  if ((reader.name() == DOCUMENT_SERIALIZE_COORD_SYSTEM) &&
575  (tokenType == QXmlStreamReader::EndElement)) {
576 
577  // Exit out of loop immediately
578  break;
579  }
580 
581  // Iterate to next StartElement
582  if (tokenType == QXmlStreamReader::StartElement) {
583 
584  // This is a StartElement, so process it
585  QString tag = reader.name().toString();
586  if (tag == DOCUMENT_SERIALIZE_AXES_CHECKER){
587  m_modelAxesChecker.loadXml (reader);
588  } else if (tag == DOCUMENT_SERIALIZE_COORDS) {
589  m_modelCoords.loadXml (reader);
590  } else if (tag == DOCUMENT_SERIALIZE_CURVE) {
591  m_curveAxes = new Curve (reader);
592  } else if (tag == DOCUMENT_SERIALIZE_CURVES_GRAPHS) {
593  m_curvesGraphs.loadXml (reader);
594  } else if (tag == DOCUMENT_SERIALIZE_DIGITIZE_CURVE) {
595  m_modelDigitizeCurve.loadXml (reader);
596  } else if (tag == DOCUMENT_SERIALIZE_EXPORT) {
597  m_modelExport.loadXml (reader);
598  } else if (tag == DOCUMENT_SERIALIZE_GENERAL || tag == DOCUMENT_SERIALIZE_COMMON) {
599  m_modelGeneral.loadXml (reader);
600  } else if (tag == DOCUMENT_SERIALIZE_GRID_DISPLAY) {
601  m_modelGridDisplay.loadXml (reader);
602  } else if (tag == DOCUMENT_SERIALIZE_GRID_REMOVAL) {
603  m_modelGridRemoval.loadXml (reader);
604  } else if (tag == DOCUMENT_SERIALIZE_IMAGE) {
605  ENGAUGE_ASSERT (false); // The image should have been read before this method was called
606  } else if (tag == DOCUMENT_SERIALIZE_POINT_MATCH) {
607  m_modelPointMatch.loadXml (reader);
608  } else if (tag == DOCUMENT_SERIALIZE_SEGMENTS) {
609  m_modelSegments.loadXml (reader);
610  } else {
611  m_successfulRead = false;
612  m_reasonForUnsuccessfulRead = QString ("Unexpected xml token '%1' encountered").arg (tag);
613  break;
614  }
615  }
616  }
617 
618  resetSelectedCurveNameIfNecessary ();
619 }
620 
622 {
623  return m_modelAxesChecker;
624 }
625 
627 {
628  // Construct a curve-specific model
630 
631  return modelColorFilter;
632 }
633 
635 {
636  return m_modelCoords;
637 }
638 
640 {
641  // Construct a curve-specific model
643 
644  return modelCurveStyles;
645 }
646 
648 {
649  return m_modelDigitizeCurve;
650 }
651 
653 {
654  return m_modelExport;
655 }
656 
658 {
659  return m_modelGeneral;
660 }
661 
663 {
664  return m_modelGridDisplay;
665 }
666 
668 {
669  return m_modelGridRemoval;
670 }
671 
673 {
674  return m_modelPointMatch;
675 }
676 
678 {
679  return m_modelSegments;
680 }
681 
682 void CoordSystem::movePoint (const QString &pointIdentifier,
683  const QPointF &deltaScreen)
684 {
685  QString curveName = Point::curveNameFromPointIdentifier (pointIdentifier);
686 
687  Curve *curve = curveForCurveName (curveName);
688  ENGAUGE_ASSERT (curve != 0);
689  curve->movePoint (pointIdentifier,
690  deltaScreen);
691 }
692 
693 int CoordSystem::nextOrdinalForCurve (const QString &curveName) const
694 {
695  CallbackNextOrdinal ftor (curveName);
696 
697  Functor2wRet<const QString &, const Point &, CallbackSearchReturn> ftorWithCallback = functor_ret (ftor,
699 
700  if (curveName == AXIS_CURVE_NAME) {
701  m_curveAxes->iterateThroughCurvePoints (ftorWithCallback);
702  } else {
703  m_curvesGraphs.iterateThroughCurvesPoints (ftorWithCallback);
704  }
705 
706  return ftor.nextOrdinal ();
707 }
708 
709 QPointF CoordSystem::positionGraph (const QString &pointIdentifier) const
710 {
711  QString curveName = Point::curveNameFromPointIdentifier (pointIdentifier);
712 
713  const Curve *curve = curveForCurveName (curveName);
714  return curve->positionGraph (pointIdentifier);
715 }
716 
717 QPointF CoordSystem::positionScreen (const QString &pointIdentifier) const
718 {
719  QString curveName = Point::curveNameFromPointIdentifier (pointIdentifier);
720 
721  const Curve *curve = curveForCurveName (curveName);
722  return curve->positionScreen (pointIdentifier);
723 }
724 
725 void CoordSystem::print () const
726 {
727  QString text;
728  QTextStream str (&text);
729 
730  printStream ("",
731  str);
732  std::cerr << text.toLatin1().data();
733 }
734 
735 void CoordSystem::printStream (QString indentation,
736  QTextStream &str) const
737 {
738  str << indentation << "Graph\n";
739 
740  indentation += INDENTATION_DELTA;
741 
742  // str << indentation << "name=" << m_name << "\n";
743  // str << indentation << "pixmap=" << m_pixmap.width() << "x" << m_pixmap.height() << "\n";
744 
745  m_curveAxes->printStream (indentation,
746  str);
747  m_curvesGraphs.printStream (indentation,
748  str);
749 
750  m_modelAxesChecker.printStream (indentation,
751  str);
752  m_modelCoords.printStream (indentation,
753  str);
754  m_modelDigitizeCurve.printStream (indentation,
755  str);
756  m_modelExport.printStream (indentation,
757  str);
758  m_modelGeneral.printStream (indentation,
759  str);
760  m_modelGridDisplay.printStream (indentation,
761  str);
762  m_modelGridRemoval.printStream (indentation,
763  str);
764  m_modelPointMatch.printStream (indentation,
765  str);
766  m_modelSegments.printStream (indentation,
767  str);
768 }
769 
771 {
772  ENGAUGE_ASSERT (!m_successfulRead);
773 
774  return m_reasonForUnsuccessfulRead;
775 }
776 
777 void CoordSystem::removePointAxis (const QString &identifier)
778 {
779  LOG4CPP_INFO_S ((*mainCat)) << "CoordSystem::removePointAxis identifier=" << identifier.toLatin1 ().data ();
780 
781  m_curveAxes->removePoint (identifier);
782 }
783 
784 void CoordSystem::removePointGraph (const QString &identifier)
785 {
786  LOG4CPP_INFO_S ((*mainCat)) << "CoordSystem::removePointGraph identifier=" << identifier.toLatin1 ().data ();
787 
788  m_curvesGraphs.removePoint (identifier);
789 }
790 
792 {
794 
795  Functor2wRet<const QString &, const Point &, CallbackSearchReturn> ftorWithCallback = functor_ret (ftor,
797 
798  curvesGraphs.iterateThroughCurvesPoints (ftorWithCallback);
799 }
800 
801 void CoordSystem::resetSelectedCurveNameIfNecessary ()
802 {
803  if (m_selectedCurveName.isEmpty () ||
804  curveForCurveName (m_selectedCurveName) == 0) {
805 
806  // Selected curve name is empty, or the curve has been removed so we pick another. The first is arbitrarily picked
807  m_selectedCurveName = m_curvesGraphs.curvesGraphsNames().first();
808  }
809 
810 }
811 
812 void CoordSystem::saveXml (QXmlStreamWriter &writer) const
813 {
814  writer.writeStartElement(DOCUMENT_SERIALIZE_COORD_SYSTEM);
815 
816  // Serialize the Document variables
817  m_modelGeneral.saveXml (writer);
818  m_modelCoords.saveXml (writer);
819  m_modelDigitizeCurve.saveXml (writer);
820  m_modelExport.saveXml (writer);
821  m_modelAxesChecker.saveXml (writer);
822  m_modelGridDisplay.saveXml (writer);
823  m_modelGridRemoval.saveXml (writer);
824  m_modelPointMatch.saveXml (writer);
825  m_modelSegments.saveXml (writer);
826  m_curveAxes->saveXml (writer);
827  m_curvesGraphs.saveXml (writer);
828  writer.writeEndElement();
829 }
830 
832 {
833  return m_selectedCurveName;
834 }
835 
837 {
838  LOG4CPP_INFO_S ((*mainCat)) << "CoordSystem::setCurveAxes";
839 
840  if (m_curveAxes != 0) {
841  delete m_curveAxes;
842  m_curveAxes = 0;
843  }
844 
845  m_curveAxes = new Curve (curveAxes);
846 }
847 
849 {
850  LOG4CPP_INFO_S ((*mainCat)) << "CoordSystem::setCurvesGraphs";
851 
852  m_curvesGraphs = curvesGraphs;
853 
854  resetSelectedCurveNameIfNecessary ();
855 }
856 
858 {
859  m_modelAxesChecker = modelAxesChecker;
860 }
861 
863 {
864  // Save the CurveFilter for each Curve
865  ColorFilterSettingsList::const_iterator itr;
866  for (itr = modelColorFilter.colorFilterSettingsList().constBegin ();
867  itr != modelColorFilter.colorFilterSettingsList().constEnd();
868  itr++) {
869 
870  QString curveName = itr.key();
871  const ColorFilterSettings &colorFilterSettings = itr.value();
872 
873  Curve *curve = curveForCurveName (curveName);
874  curve->setColorFilterSettings (colorFilterSettings);
875  }
876 }
877 
879 {
880  m_modelCoords = modelCoords;
881 }
882 
884 {
885  // Save the LineStyle and PointStyle for each Curve
886  QStringList curveNames = modelCurveStyles.curveNames();
887  QStringList::iterator itr;
888  for (itr = curveNames.begin(); itr != curveNames.end(); itr++) {
889 
890  QString curveName = *itr;
891  const CurveStyle &curveStyle = modelCurveStyles.curveStyle (curveName);
892 
893  Curve *curve = curveForCurveName (curveName);
894  curve->setCurveStyle (curveStyle);
895  }
896 }
897 
899 {
900  m_modelDigitizeCurve = modelDigitizeCurve;
901 }
902 
904 {
905  m_modelExport = modelExport;
906 }
907 
909 {
910  m_modelGeneral = modelGeneral;
911 }
912 
914 {
915  m_modelGridDisplay = modelGridDisplay;
916 }
917 
919 {
920  m_modelGridRemoval = modelGridRemoval;
921 }
922 
924 {
925  m_modelPointMatch = modelPointMatch;
926 }
927 
929 {
930  m_modelSegments = modelSegments;
931 }
932 
934 {
935  m_selectedCurveName = selectedCurveName;
936 }
937 
939 {
940  return m_successfulRead;
941 }
942 
944 {
945  LOG4CPP_INFO_S ((*mainCat)) << "CoordSystem::updatePointOrdinals";
946 
947  // The graph coordinates of all points in m_curvesGraphs must have already been updated at this point. See applyTransformation
948  m_curvesGraphs.updatePointOrdinals (transformation);
949 }
bool isError() const
True if an error occurred during iteration.
void loadVersion6(QXmlStreamReader &reader)
Load from file in version 6 format.
void setPointsSelectionFunctions(ExportPointsSelectionFunctions exportPointsSelectionFunctions)
Set method for point selection for functions.
void printStream(QString indentation, QTextStream &str) const
Debugging method that supports print method of this class and printStream method of some other class(...
const ColorFilterSettingsList & colorFilterSettingsList() const
Get method for copying all color filters in one step.
CallbackSearchReturn callback(const QString &curveName, const Point &point)
Callback method.
void removePoint(const QString &identifier)
Perform the opposite of addPointAtEnd.
Definition: Curve.cpp:501
Manage storage and retrieval of the settings for the curves.
Model for DlgSettingsGeneral and CmdSettingsGeneral.
CurveStyle curveStyle(const QString &curveName) const
CurveStyle in specified curve.
Definition: CurveStyles.cpp:79
static QString curveNameFromPointIdentifier(const QString &pointIdentifier)
Parse the curve name from the specified point identifier. This does the opposite of uniqueIdentifierG...
Definition: Point.cpp:227
void printStream(QString indentation, QTextStream &str) const
Debugging method that supports print method of this class and printStream method of some other class(...
virtual void saveXml(QXmlStreamWriter &writer) const
Save entire model as xml into stream.
void printStream(QString indentation, QTextStream &str) const
Debugging method that supports print method of this class and printStream method of some other class(...
void setStartX(double startX)
Set method for x grid line lower bound (inclusive).
Model for DlgSettingsPointMatch and CmdSettingsPointMatch.
Callback for computing the next ordinal for a new point.
Color filter parameters for one curve. For a class, this is handled the same as LineStyle and PointSt...
static LineStyle defaultGraphCurve(int index)
Initial default for index&#39;th graph curve.
Definition: LineStyle.cpp:84
Model for DlgSettingsGridDisplay and CmdSettingsGridDisplay.
int curvesGraphsNumPoints(const QString &curveName) const
Point count.
void loadXml(QXmlStreamReader &reader)
Load from serialized xml post-version 5 file.
virtual void setModelAxesChecker(const DocumentModelAxesChecker &modelAxesChecker)
Set method for DocumentModelAxesChecker.
virtual void printStream(QString indentation, QTextStream &str) const
Debugging method that supports print method of this class and printStream method of some other class(...
Callback that is used when iterating through a read-only CurvesGraphs to remove corresponding points ...
virtual void saveXml(QXmlStreamWriter &writer) const
Save entire model as xml into stream.
void setCurveStyle(const CurveStyle &curveStyle)
Set curve style.
Definition: Curve.cpp:554
void setCloseDistance(double closeDistance)
Set method for close distance.
Model for DlgSettingsExportFormat and CmdSettingsExportFormat.
void setLineColor(ColorPalette lineColor)
Set method for line color.
void setCountY(unsigned int countY)
Set method for y grid line count.
void setStepX(double stepX)
Set method for x grid line increment.
virtual DocumentModelGridRemoval modelGridRemoval() const
Get method for DocumentModelGridRemoval.
QStringList curveNames() const
List of all curve names.
Definition: CurveStyles.cpp:67
void printStream(QString indentation, QTextStream &str) const
Debugging method that supports print method of this class and printStream method of some other class(...
Model for DlgSettingsCurveProperties and CmdSettingsCurveProperties.
Definition: CurveStyles.h:22
void setCountX(int countX)
Set method for x count.
void setModelPointMatch(const DocumentModelPointMatch &modelPointMatch)
Set method for DocumentModelPointMatch.
void iterateThroughCurvePoints(const Functor2wRet< const QString &, const Point &, CallbackSearchReturn > &ftorWithCallback) const
Apply functor to Points on Curve.
Definition: Curve.cpp:292
void setMinLength(double minLength)
Set method for min length.
void loadPreVersion6(QDataStream &str, double version)
Load from file in pre-version 6 format.
virtual DocumentModelGridDisplay modelGridDisplay() const
Get method for DocumentModelGridDisplay.
virtual void saveXml(QXmlStreamWriter &writer) const
Save entire model as xml into stream.
void addPoint(Point point)
Add Point to this Curve.
Definition: Curve.cpp:124
virtual void checkEditPointAxis(const QString &pointIdentifier, const QPointF &posScreen, const QPointF &posGraph, bool &isError, QString &errorMessage)
Check before calling editPointAxis.
virtual const CurvesGraphs & curvesGraphs() const
Make all Curves available, read only, for CmdAbstract classes only.
virtual QString reasonForUnsuccessfulRead() const
Return an informative text message explaining why startup loading failed. Applies if successfulRead r...
void setColorFilterSettings(const ColorFilterSettings &colorFilterSettings)
Set color filter.
Definition: Curve.cpp:537
virtual void loadXml(QXmlStreamReader &reader)
Load model from serialized xml.
void setPaletteColorCandidate(ColorPalette paletteColorCandidate)
Set method for candidate color.
virtual void setModelGridDisplay(const DocumentModelGridDisplay &modelGridDisplay)
Set method for DocumentModelGridDisplay.
QString errorMessage() const
Error message that explains the problem indicated by isError.
void setStopY(double stopY)
Set method for y stop.
virtual void loadXml(QXmlStreamReader &reader)
Load model from serialized xml.
virtual DocumentModelPointMatch modelPointMatch() const
Get method for DocumentModelPointMatch.
virtual void saveXml(QXmlStreamWriter &writer) const
Save entire model as xml into stream.
Curve * curveForCurveName(const QString &curveName)
Return the axis or graph curve for the specified curve name.
virtual bool successfulRead() const
Return true if startup loading succeeded. If the loading failed then reasonForUnsuccessfulRed will ex...
QPointF positionScreen(const QString &pointIdentifier) const
Return the position, in screen coordinates, of the specified Point.
Definition: Curve.cpp:464
void setCoordScaleYRadius(CoordScale coordScale)
Set method for linear/log scale on y/radius.
Callback that is used when iterating through a read-only CurvesGraphs to add corresponding points in ...
virtual void updatePointOrdinals(const Transformation &transformation)
Update point ordinals after point addition/removal or dragging.
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
virtual void setModelExport(const DocumentModelExportFormat &modelExport)
Set method for DocumentModelExportFormat.
virtual void saveXml(QXmlStreamWriter &writer) const
Save entire model as xml into stream.
void addGraphCurveAtEnd(Curve curve)
Append new graph Curve to end of Curve list.
void iterateThroughCurvesPoints(const Functor2wRet< const QString &, const Point &, CallbackSearchReturn > &ftorWithCallback)
Apply functor to Points on all of the Curves.
virtual QStringList curvesGraphsNames() const
See CurvesGraphs::curvesGraphsNames.
void setStartY(double startY)
Set method for y start.
void setStepY(double stepY)
Set method for y step.
Class that represents one digitized point. The screen-to-graph coordinate transformation is always ex...
Definition: Point.h:23
void setStepY(double yStep)
Set method for y grid line increment.
virtual void loadXml(QXmlStreamReader &reader)
Load model from serialized xml.
bool isXOnly(const QString &pointIdentifier) const
Return true if y coordinate is undefined, otherwise x coordinae is undefined in DOCUMENT_AXES_POINT_R...
Callback for sanity checking the screen and graph coordinates of an axis point that is in the axes cu...
virtual DocumentModelDigitizeCurve modelDigitizeCurve() const
Get method for DocumentModelDigitizeCurve.
void printStream(QString indentation, QTextStream &str) const
Debugging method that supports print method of this class and printStream method of some other class(...
void setDelimiter(ExportDelimiter exportDelimiter)
Set method for delimiter.
void setStartX(double startX)
Set method for x start.
virtual void loadXml(QXmlStreamReader &reader)
Load model from serialized xml.
CallbackSearchReturn callback(const QString &curveName, const Point &point)
Callback method.
virtual void setModelSegments(const DocumentModelSegments &modelSegments)
Set method for DocumentModelSegments.
virtual void setModelGridRemoval(const DocumentModelGridRemoval &modelGridRemoval)
Set method for DocumentModelGridRemoval.
void setLineWidth(double lineWidth)
Set method for line width.
int numPoints() const
Number of points.
Definition: Curve.cpp:423
void editPointGraph(bool isX, bool isY, double x, double y, const QStringList &identifiers, const Transformation &transformation)
Set the x and/or y coordinate values of the specified points.
virtual void loadXml(QXmlStreamReader &reader)
Load model from serialized xml.
virtual void iterateThroughCurveSegments(const QString &curveName, const Functor2wRet< const Point &, const Point &, CallbackSearchReturn > &ftorWithCallback) const
See Curve::iterateThroughCurveSegments, for any axes or graph curve.
void loadVersions7AndUp(QXmlStreamReader &reader, DocumentAxesPointsRequired documentAxesPointsRequired)
Load from file in versions 7 and 8 formats.
virtual void checkAddPointAxis(const QPointF &posScreen, const QPointF &posGraph, bool &isError, QString &errorMessage, bool isXOnly)
Check before calling addPointAxis. Also returns the next available ordinal number (to prevent clashes...
void printStream(QString indentation, QTextStream &str) const
Debugging method that supports print method of this class and printStream method of some other class(...
void setCountY(int countY)
Set method for y count.
void movePoint(const QString &pointIdentifier, const QPointF &deltaScreen)
Translate the position of a point by the specified distance vector.
Definition: Curve.cpp:414
virtual void addPointGraphWithGeneratedIdentifier(const QString &curveName, const QPointF &posScreen, QString &generatedIentifier, double ordinal)
Add a single graph point with a generated point identifier.
void setLayoutFunctions(ExportLayoutFunctions exportLayoutFunctions)
Set method for functions layout.
static ColorFilterSettings defaultFilter()
Initial default for any Curve.
virtual void loadXml(QXmlStreamReader &reader)
Load model from serialized xml.
virtual int nextOrdinalForCurve(const QString &curveName) const
Default next ordinal value for specified curve.
void setStable(bool stable)
Set method for stable flag.
void saveXml(QXmlStreamWriter &writer) const
Serialize curves.
virtual void setModelGeneral(const DocumentModelGeneral &modelGeneral)
Set method for DocumentModelGeneral.
virtual DocumentModelCoords modelCoords() const
Get method for DocumentModelCoords.
Model for DlgSettingsDigitizeCurve and CmdSettingsDigitizeCurve.
virtual void setCurvesGraphs(const CurvesGraphs &curvesGraphs)
Let CmdAbstract classes overwrite CurvesGraphs. Applies to current coordinate system.
QString identifier() const
Unique identifier for a specific Point.
Definition: Point.cpp:256
virtual DocumentModelSegments modelSegments() const
Get method for DocumentModelSegments.
Affine transformation between screen and graph coordinates, based on digitized axis points...
Details for a specific Point.
Definition: PointStyle.h:20
void setStepX(double stepX)
Set method for x step.
void setMaxPointSize(double maxPointSize)
Set method for max point size.
void addPoint(const Point &point)
Append new Point to the specified Curve.
Container for all graph curves. The axes point curve is external to this class.
Definition: CurvesGraphs.h:24
Model for DlgSettingsColorFilter and CmdSettingsColorFilter.
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
virtual void saveXml(QXmlStreamWriter &writer) const
Save entire model as xml into stream.
virtual void loadXml(QXmlStreamReader &reader)
Load model from serialized xml.
virtual void setCurveAxes(const Curve &curveAxes)
Let CmdAbstract classes overwrite axes Curve. Applies to current coordinate system.
void setStopX(double stopX)
Set method for x grid line upper bound (inclusive).
virtual void addPointAxisWithSpecifiedIdentifier(const QPointF &posScreen, const QPointF &posGraph, const QString &identifier, double ordinal, bool isXOnly)
Add a single axis point with the specified point identifier.
Definition: CoordSystem.cpp:90
virtual void loadXml(QXmlStreamReader &reader)
Load model from serialized xml.
virtual DocumentModelAxesChecker modelAxesChecker() const
Get method for DocumentModelAxesChecker.
virtual void removePointsInCurvesGraphs(CurvesGraphs &curvesGraphs)
Remove all points identified in the specified CurvesGraphs. See also addPointsInCurvesGraphs.
virtual void saveXml(QXmlStreamWriter &writer) const
Save entire model as xml into stream.
virtual void saveXml(QXmlStreamWriter &writer) const
Save graph to xml.
virtual void loadXml(QXmlStreamReader &reader)
Load model from serialized xml.
virtual void setModelColorFilter(const DocumentModelColorFilter &modelColorFilter)
Set method for DocumentModelColorFilter.
void setCoordUnitsTheta(CoordUnitsPolarTheta coordUnits)
Set method for theta units.
virtual DocumentModelColorFilter modelColorFilter() const
Get method for DocumentModelColorFilter.
void setRemoveDefinedGridLines(bool removeDefinedGridLines)
Set method for removing defined grid lines.
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
int numCurves() const
Current number of graphs curves.
virtual void removePointGraph(const QString &identifier)
Perform the opposite of addPointGraph.
void setDisableX(GridCoordDisable disableX)
Set method for x grid line disabled variable.
void setStopY(double yStop)
Set method for y grid line upper bound (inclusive).
CallbackSearchReturn callback(const QString &curveName, const Point &point)
Callback method.
Model for DlgSettingsCoords and CmdSettingsCoords.
Container for LineStyle and PointStyle for one Curve.
Definition: CurveStyle.h:18
void setOriginRadius(double originRadius)
Set method for origin radius in polar mode.
void setGridCoordDisableY(GridCoordDisable gridCoordDisable)
Set method for y coord parameter to disable.
void setDisableY(GridCoordDisable disableY)
Set method for y grid line disabled variable.
Container for one set of digitized Points.
Definition: Curve.h:32
void updatePointOrdinals(const Transformation &transformation)
Update point ordinals to be consistent with their CurveStyle and x/theta coordinate.
Details for a specific Line.
Definition: LineStyle.h:19
virtual QPointF positionGraph(const QString &pointIdentifier) const
See Curve::positionGraph.
void iterateThroughCurveSegments(const QString &curveNameWanted, const Functor2wRet< const Point &, const Point &, CallbackSearchReturn > &ftorWithCallback) const
Apply functor to segments on the specified axis or graph Curve.
void setCoordUnitsRadius(CoordUnitsNonPolarTheta coordUnits)
Set method for radius units.
void setGridCoordDisableX(GridCoordDisable gridCoordDisable)
Set method for x coord parameter to disable.
QPointF positionGraph(const QString &pointIdentifier) const
Return the position, in graph coordinates, of the specified Point.
Definition: Curve.cpp:447
void setPaletteColorRejected(ColorPalette paletteColorRejected)
Set method for rejected color.
virtual Curve * curveForCurveName(const QString &curveName)
See CurvesGraphs::curveForCurveName, although this also works for AXIS_CURVE_NAME.
void setCountX(unsigned int countX)
Set method for x grid line count.
QStringList curvesGraphsNames() const
List of graph curve names.
void setStartY(double yStart)
Set method for y grid line lower bound (inclusive).
virtual void removePointAxis(const QString &identifier)
Perform the opposite of addPointAxis.
Model for DlgSettingsAxesChecker and CmdSettingsAxesChecker.
virtual void addGraphCurveAtEnd(const QString &curveName)
Add new graph curve to the list of existing graph curves.
Definition: CoordSystem.cpp:58
virtual QPointF positionScreen(const QString &pointIdentifier) const
See Curve::positionScreen.
void printStream(QString indentation, QTextStream &str) const
Debugging method that supports print method of this class and printStream method of some other class(...
void setStable()
Set the stable flag to true. This public version has no argument since it cannot be undone...
CoordsType coordsType() const
Get method for coordinates type.
virtual bool loadCurvesFile(const QString &curvesFile)
Load the curve names in the specified Engauge file into the current graph. This is called near the en...
virtual void addPointGraphWithSpecifiedIdentifier(const QString &curveName, const QPointF &posScreen, const QString &identifier, double ordinal)
Add a single graph point with the specified point identifer. Note that PointStyle is not applied to t...
virtual void addPointAxisWithGeneratedIdentifier(const QPointF &posScreen, const QPointF &posGraph, QString &identifier, double ordinal, bool isXOnly)
Add a single axis point with a generated point identifier.
Definition: CoordSystem.cpp:68
virtual void print() const
Debugging method for printing directly from symbolic debugger.
void printStream(QString indentation, QTextStream &str) const
Debugging method that supports print method of this class and printStream method of some other class(...
virtual void movePoint(const QString &pointIdentifier, const QPointF &deltaScreen)
See Curve::movePoint.
virtual 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.
virtual DocumentModelGeneral modelGeneral() const
Get method for DocumentModelGeneral.
void setPointsIntervalUnitsRelations(ExportPointsIntervalUnits pointsIntervalUnitsRelations)
Set method for points interval units for relations.
virtual void addPointsInCurvesGraphs(CurvesGraphs &curvesGraphs)
Add all points identified in the specified CurvesGraphs. See also removePointsInCurvesGraphs.
virtual void iterateThroughCurvesPointsGraphs(const Functor2wRet< const QString &, const Point &, CallbackSearchReturn > &ftorWithCallback)
See Curve::iterateThroughCurvePoints, for all the graphs curves.
Model for DlgSettingsSegments and CmdSettingsSegments.
virtual DocumentModelExportFormat modelExport() const
Get method for DocumentModelExportFormat.
double nextOrdinal() const
Computed next ordinal.
void loadPreVersion6(QDataStream &str)
Load from serialized binary pre-version 6 file.
void printStream(QString indentation, QTextStream &str) const
Debugging method that supports print method of this class and printStream method of some other class(...
virtual int curvesGraphsNumPoints(const QString &curveName) const
See CurvesGraphs::curvesGraphsNumPoints.
Callback for sanity checking the screen and graph coordinates of an axis point, before it is added to...
virtual void editPointAxis(const QPointF &posGraph, const QString &identifier)
Edit the graph coordinates of a single axis point. Call this after checkAddPointAxis to guarantee suc...
void setHeader(ExportHeader exportHeader)
Set method for header.
void saveXml(QXmlStreamWriter &writer) const
Serialize curve.
Definition: Curve.cpp:514
virtual void saveXml(QXmlStreamWriter &writer) const
Save entire model as xml into stream.
virtual void setModelCurveStyles(const CurveStyles &modelCurveStyles)
Set method for CurveStyles.
virtual void setSelectedCurveName(const QString &selectedCurveName)
Save curve name that is selected for the current coordinate system, for the next time the coordinate ...
virtual CurveStyles modelCurveStyles() const
Get method for CurveStyles.
void removePoint(const QString &pointIdentifier)
Remove the Point from its Curve.
QString errorMessage() const
Error message that explains the problem indicated by isError.
virtual const Curve & curveAxes() const
Get method for axis curve.
Model for DlgSettingsGridRemoval and CmdSettingsGridRemoval. The settings are unstable until the user...
virtual QString selectedCurveName() const
Currently selected curve name. This is used to set the selected curve combobox in MainWindow...
bool isError() const
True if an error occurred during iteration.
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
static PointStyle defaultGraphCurve(int index)
Initial default for index&#39;th graph curve.
Definition: PointStyle.cpp:83
void setPointSeparation(double pointSeparation)
Set method for point separation.
QString defaultCurveName(int indexOneBased, const QString &defaultName) const
Default graph name for the specified curve index.
CoordSystem(DocumentAxesPointsRequired documentAxesPointsRequired)
Single constructor.
Definition: CoordSystem.cpp:38
void setPaletteColorAccepted(ColorPalette paletteColorAccepted)
Set method for accepted color.
void setStopX(double stopX)
Set method for x stop.
virtual void iterateThroughCurvePointsAxes(const Functor2wRet< const QString &, const Point &, CallbackSearchReturn > &ftorWithCallback)
See Curve::iterateThroughCurvePoints, for the axes curve.
void setCoordScaleXTheta(CoordScale coordScale)
Set method for linear/log scale on x/theta.
virtual void setModelCoords(const DocumentModelCoords &modelCoords)
Set method for DocumentModelCoords.
CallbackSearchReturn callback(const QString &curveName, const Point &point)
Callback method.
void printStream(QString indentation, QTextStream &str) const
Debugging method that supports print method of this class and printStream method of some other class(...
void setXLabel(const QString &xLabel)
Set method for x label.
virtual void setModelDigitizeCurve(const DocumentModelDigitizeCurve &modelDigitizeCurve)
Set method for DocumentModelDigitizeCurve.
virtual void saveXml(QXmlStreamWriter &writer) const
Save entire model as xml into stream.
void setCoordsType(CoordsType coordsType)
Set method for coordinates type.