Engauge Digitizer  2
 All Classes Files Functions Variables Enumerations Enumerator Friends Pages
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 posGraph=("
269  << posGraph.x () << ", " << posGraph.y () << ") identifier="
270  << identifier.toLatin1 ().data ();
271 
272  m_curveAxes->editPoint (posGraph,
273  identifier);
274 }
275 
276 bool CoordSystem::isXOnly (const QString &pointIdentifier) const
277 {
278  return m_curveAxes->isXOnly (pointIdentifier);
279 }
280 
281 void CoordSystem::iterateThroughCurvePointsAxes (const Functor2wRet<const QString &, const Point &, CallbackSearchReturn> &ftorWithCallback)
282 {
283  ENGAUGE_CHECK_PTR (m_curveAxes);
284 
285  m_curveAxes->iterateThroughCurvePoints (ftorWithCallback);
286 }
287 
288 void CoordSystem::iterateThroughCurvePointsAxes (const Functor2wRet<const QString &, const Point &, CallbackSearchReturn> &ftorWithCallback) const
289 {
290  ENGAUGE_CHECK_PTR (m_curveAxes);
291 
292  m_curveAxes->iterateThroughCurvePoints (ftorWithCallback);
293 }
294 
295 void CoordSystem::iterateThroughCurveSegments (const QString &curveName,
296  const Functor2wRet<const Point &, const Point &, CallbackSearchReturn> &ftorWithCallback) const
297 {
298  if (curveName == AXIS_CURVE_NAME) {
299  m_curveAxes->iterateThroughCurveSegments(ftorWithCallback);
300  } else {
301  m_curvesGraphs.iterateThroughCurveSegments(curveName,
302  ftorWithCallback);
303  }
304 }
305 
306 void CoordSystem::iterateThroughCurvesPointsGraphs (const Functor2wRet<const QString &, const Point &, CallbackSearchReturn> &ftorWithCallback)
307 {
308  ENGAUGE_CHECK_PTR (m_curveAxes);
309 
310  m_curvesGraphs.iterateThroughCurvesPoints (ftorWithCallback);
311 }
312 
313 void CoordSystem::iterateThroughCurvesPointsGraphs (const Functor2wRet<const QString &, const Point &, CallbackSearchReturn> &ftorWithCallback) const
314 {
315  ENGAUGE_CHECK_PTR (m_curveAxes);
316 
317  m_curvesGraphs.iterateThroughCurvesPoints (ftorWithCallback);
318 }
319 
320 bool CoordSystem::loadCurvesFile(const QString & /* curvesFile */)
321 {
322  LOG4CPP_INFO_S ((*mainCat)) << "CoordSystem::loadCurvesFile";
323 
324  return true;
325 }
326 
327 void CoordSystem::loadPreVersion6 (QDataStream &str,
328  double version)
329 {
330  LOG4CPP_INFO_S ((*mainCat)) << "CoordSystem::loadPreVersion6";
331 
332  qint32 int32;
333  double dbl, radius = 0.0;
334  QString st;
335 
336  m_documentAxesPointsRequired = DOCUMENT_AXES_POINTS_REQUIRED_3;
337 
338  str >> st; // CurveCmbText selection
339  str >> st; // MeasureCmbText selection
340  str >> int32;
341  m_modelCoords.setCoordsType((CoordsType) int32);
342  if (version >= 3) {
343  str >> (double &) radius;
344  }
345  m_modelCoords.setOriginRadius(radius);
346  str >> int32;
347  m_modelCoords.setCoordUnitsRadius(COORD_UNITS_NON_POLAR_THETA_NUMBER);
348  m_modelCoords.setCoordUnitsTheta((CoordUnitsPolarTheta) int32);
349  str >> int32;
350  m_modelCoords.setCoordScaleXTheta((CoordScale) int32);
351  str >> int32;
352  m_modelCoords.setCoordScaleYRadius((CoordScale) int32);
353 
354  str >> int32;
355  m_modelExport.setDelimiter((ExportDelimiter) int32);
356  str >> int32;
357  m_modelExport.setLayoutFunctions((ExportLayoutFunctions) int32);
358  str >> int32;
359  m_modelExport.setPointsSelectionFunctions((ExportPointsSelectionFunctions) int32);
360  m_modelExport.setPointsIntervalUnitsRelations((ExportPointsIntervalUnits) int32);
361  str >> int32;
362  m_modelExport.setHeader((ExportHeader) int32);
363  if (version >= 5.1) {
364  str >> st; // X label
365  if (m_modelCoords.coordsType() == COORDS_TYPE_CARTESIAN) {
366  m_modelExport.setXLabel(st);
367  }
368  str >> st; // Theta label
369  if (m_modelCoords.coordsType() == COORDS_TYPE_POLAR) {
370  m_modelExport.setXLabel(st);
371  }
372  }
373 
374  // Stable flag in m_modelGridRemoval is set below after points are read in
375  str >> int32; // Remove thin lines parallel to axes
376  str >> dbl; // Thin thickness
377  str >> int32;
378  m_modelGridRemoval.setRemoveDefinedGridLines(int32);
379  str >> int32; // Initialized
380  str >> int32;
381  m_modelGridRemoval.setCountX(int32);
382  str >> int32;
383  m_modelGridRemoval.setCountY(int32);
384  str >> int32;
385  m_modelGridRemoval.setGridCoordDisableX((GridCoordDisable) int32);
386  str >> int32;
387  m_modelGridRemoval.setGridCoordDisableY((GridCoordDisable) int32);
388  str >> dbl;
389  m_modelGridRemoval.setStartX(dbl);
390  str >> dbl;
391  m_modelGridRemoval.setStartY(dbl);
392  str >> dbl;
393  m_modelGridRemoval.setStepX(dbl);
394  str >> dbl;
395  m_modelGridRemoval.setStepY(dbl);
396  str >> dbl;
397  m_modelGridRemoval.setStopX(dbl);
398  str >> dbl;
399  m_modelGridRemoval.setStopY(dbl);
400  str >> dbl;
401  m_modelGridRemoval.setCloseDistance(dbl);
402  str >> int32; // Boolean remove color flag
403  if (version >= 5) {
404  QColor color;
405  str >> color;
406  } else {
407  str >> int32; // Rgb color
408  }
409  str >> int32; // Foreground threshold low
410  str >> int32; // Foreground threshold high
411  str >> dbl; // Gap separation
412 
413  str >> int32;
414  m_modelGridDisplay.setStable(int32);
415  str >> int32;
416  m_modelGridDisplay.setCountX(int32);
417  str >> int32;
418  m_modelGridDisplay.setCountY(int32);
419  str >> int32;
420  m_modelGridDisplay.setDisableX((GridCoordDisable) int32);
421  str >> int32;
422  m_modelGridDisplay.setDisableY((GridCoordDisable) int32);
423  str >> dbl;
424  m_modelGridDisplay.setStartX (dbl);
425  str >> dbl;
426  m_modelGridDisplay.setStartY (dbl);
427  str >> dbl;
428  m_modelGridDisplay.setStepX (dbl);
429  str >> dbl;
430  m_modelGridDisplay.setStepY (dbl);
431  str >> dbl;
432  m_modelGridDisplay.setStopX (dbl);
433  str >> dbl;
434  m_modelGridDisplay.setStopY (dbl);
435 
436  str >> int32;
437  m_modelSegments.setMinLength(int32);
438  str >> int32;
439  m_modelSegments.setPointSeparation(int32);
440  str >> int32;
441  m_modelSegments.setLineWidth(int32);
442  str >> int32;
443  m_modelSegments.setLineColor((ColorPalette) int32);
444 
445  str >> int32; // Point separation
446  str >> int32;
447  m_modelPointMatch.setMaxPointSize(int32);
448  str >> int32;
449  m_modelPointMatch.setPaletteColorAccepted((ColorPalette) int32);
450  str >> int32;
451  m_modelPointMatch.setPaletteColorRejected((ColorPalette) int32);
452  if (version < 4) {
453  m_modelPointMatch.setPaletteColorCandidate(COLOR_PALETTE_BLUE);
454  } else {
455  str >> int32;
456  m_modelPointMatch.setPaletteColorCandidate((ColorPalette) int32);
457  }
458 
459  str >> int32; // Discretize method
460  str >> int32; // Intensity threshold low
461  str >> int32; // Intensity threshold high
462  str >> int32; // Foreground threshold low
463  str >> int32; // Foreground threshold high
464  str >> int32; // Hue threshold low
465  str >> int32; // Hue threshold high
466  str >> int32; // Saturation threshold low
467  str >> int32; // Saturation threshold high
468  str >> int32; // Value threshold low
469  str >> int32; // Value threshold high
470 
471  m_curveAxes = new Curve (str);
472  Curve curveScale (str); // Scales are dropped on the floor
473  m_curvesGraphs.loadPreVersion6 (str);
474 
475  // Information from curves and points can affect some data structures that were (mostly) set earlier
476  if (m_curveAxes->numPoints () > 2) {
477  m_modelGridRemoval.setStable();
478  }
479 
480  resetSelectedCurveNameIfNecessary ();
481 }
482 
483 void CoordSystem::loadVersion6 (QXmlStreamReader &reader)
484 {
485  LOG4CPP_INFO_S ((*mainCat)) << "CoordSystem::loadVersion6";
486 
487  m_documentAxesPointsRequired = DOCUMENT_AXES_POINTS_REQUIRED_3;
488 
489  // Import from xml. Loop to end of data or error condition occurs, whichever is first
490  while (!reader.atEnd() &&
491  !reader.hasError()) {
492  QXmlStreamReader::TokenType tokenType = loadNextFromReader(reader);
493 
494  if ((reader.name() == DOCUMENT_SERIALIZE_DOCUMENT) &&
495  (tokenType == QXmlStreamReader::EndElement)) {
496 
497  // Exit out of loop immediately
498  break;
499  }
500 
501  // Iterate to next StartElement
502  if (tokenType == QXmlStreamReader::StartElement) {
503 
504  // This is a StartElement, so process it
505  QString tag = reader.name().toString();
506  if (tag == DOCUMENT_SERIALIZE_AXES_CHECKER){
507  m_modelAxesChecker.loadXml (reader);
508  } else if (tag == DOCUMENT_SERIALIZE_COORDS) {
509  m_modelCoords.loadXml (reader);
510  } else if (tag == DOCUMENT_SERIALIZE_CURVE) {
511  m_curveAxes = new Curve (reader);
512  } else if (tag == DOCUMENT_SERIALIZE_CURVES_GRAPHS) {
513  m_curvesGraphs.loadXml (reader);
514  } else if (tag == DOCUMENT_SERIALIZE_DIGITIZE_CURVE) {
515  m_modelDigitizeCurve.loadXml (reader);
516  } else if (tag == DOCUMENT_SERIALIZE_EXPORT) {
517  m_modelExport.loadXml (reader);
518  } else if (tag == DOCUMENT_SERIALIZE_GENERAL || tag == DOCUMENT_SERIALIZE_COMMON) {
519  m_modelGeneral.loadXml (reader);
520  } else if (tag == DOCUMENT_SERIALIZE_GRID_REMOVAL) {
521  m_modelGridRemoval.loadXml (reader);
522  } else if (tag == DOCUMENT_SERIALIZE_IMAGE) {
523  ENGAUGE_ASSERT (false); // The image should have been read before this method was called
524  } else if (tag == DOCUMENT_SERIALIZE_POINT_MATCH) {
525  m_modelPointMatch.loadXml (reader);
526  } else if (tag == DOCUMENT_SERIALIZE_SEGMENTS) {
527  m_modelSegments.loadXml (reader);
528  } else {
529  m_successfulRead = false;
530  m_reasonForUnsuccessfulRead = QString ("%1 '%2' %3")
531  .arg (QObject::tr ("Unexpected xml token"))
532  .arg (tag)
533  .arg ("encountered");
534  break;
535  }
536  }
537  }
538 
539  resetSelectedCurveNameIfNecessary ();
540 }
541 
542 void CoordSystem::loadVersions7AndUp (QXmlStreamReader &reader,
543  DocumentAxesPointsRequired documentAxesPointsRequired)
544 {
545  LOG4CPP_INFO_S ((*mainCat)) << "CoordSystem::loadVersions7AndUp";
546 
547  m_documentAxesPointsRequired = documentAxesPointsRequired;
548 
549  // Import from xml. Loop to end of data or error condition occurs, whichever is first
550  while (!reader.atEnd() &&
551  !reader.hasError()) {
552  QXmlStreamReader::TokenType tokenType = loadNextFromReader(reader);
553 
554  if ((reader.name() == DOCUMENT_SERIALIZE_COORD_SYSTEM) &&
555  (tokenType == QXmlStreamReader::EndElement)) {
556 
557  // Exit out of loop immediately
558  break;
559  }
560 
561  // Iterate to next StartElement
562  if (tokenType == QXmlStreamReader::StartElement) {
563 
564  // This is a StartElement, so process it
565  QString tag = reader.name().toString();
566  if (tag == DOCUMENT_SERIALIZE_AXES_CHECKER){
567  m_modelAxesChecker.loadXml (reader);
568  } else if (tag == DOCUMENT_SERIALIZE_COORDS) {
569  m_modelCoords.loadXml (reader);
570  } else if (tag == DOCUMENT_SERIALIZE_CURVE) {
571  m_curveAxes = new Curve (reader);
572  } else if (tag == DOCUMENT_SERIALIZE_CURVES_GRAPHS) {
573  m_curvesGraphs.loadXml (reader);
574  } else if (tag == DOCUMENT_SERIALIZE_DIGITIZE_CURVE) {
575  m_modelDigitizeCurve.loadXml (reader);
576  } else if (tag == DOCUMENT_SERIALIZE_EXPORT) {
577  m_modelExport.loadXml (reader);
578  } else if (tag == DOCUMENT_SERIALIZE_GENERAL || tag == DOCUMENT_SERIALIZE_COMMON) {
579  m_modelGeneral.loadXml (reader);
580  } else if (tag == DOCUMENT_SERIALIZE_GRID_DISPLAY) {
581  m_modelGridDisplay.loadXml (reader);
582  } else if (tag == DOCUMENT_SERIALIZE_GRID_REMOVAL) {
583  m_modelGridRemoval.loadXml (reader);
584  } else if (tag == DOCUMENT_SERIALIZE_IMAGE) {
585  ENGAUGE_ASSERT (false); // The image should have been read before this method was called
586  } else if (tag == DOCUMENT_SERIALIZE_POINT_MATCH) {
587  m_modelPointMatch.loadXml (reader);
588  } else if (tag == DOCUMENT_SERIALIZE_SEGMENTS) {
589  m_modelSegments.loadXml (reader);
590  } else {
591  m_successfulRead = false;
592  m_reasonForUnsuccessfulRead = QString ("Unexpected xml token '%1' encountered").arg (tag);
593  break;
594  }
595  }
596  }
597 
598  resetSelectedCurveNameIfNecessary ();
599 }
600 
602 {
603  return m_modelAxesChecker;
604 }
605 
607 {
608  // Construct a curve-specific model
610 
611  return modelColorFilter;
612 }
613 
615 {
616  return m_modelCoords;
617 }
618 
620 {
621  // Construct a curve-specific model
623 
624  return modelCurveStyles;
625 }
626 
628 {
629  return m_modelDigitizeCurve;
630 }
631 
633 {
634  return m_modelExport;
635 }
636 
638 {
639  return m_modelGeneral;
640 }
641 
643 {
644  return m_modelGridDisplay;
645 }
646 
648 {
649  return m_modelGridRemoval;
650 }
651 
653 {
654  return m_modelPointMatch;
655 }
656 
658 {
659  return m_modelSegments;
660 }
661 
662 void CoordSystem::movePoint (const QString &pointIdentifier,
663  const QPointF &deltaScreen)
664 {
665  QString curveName = Point::curveNameFromPointIdentifier (pointIdentifier);
666 
667  Curve *curve = curveForCurveName (curveName);
668  ENGAUGE_ASSERT (curve != 0);
669  curve->movePoint (pointIdentifier,
670  deltaScreen);
671 }
672 
673 int CoordSystem::nextOrdinalForCurve (const QString &curveName) const
674 {
675  CallbackNextOrdinal ftor (curveName);
676 
677  Functor2wRet<const QString &, const Point &, CallbackSearchReturn> ftorWithCallback = functor_ret (ftor,
679 
680  if (curveName == AXIS_CURVE_NAME) {
681  m_curveAxes->iterateThroughCurvePoints (ftorWithCallback);
682  } else {
683  m_curvesGraphs.iterateThroughCurvesPoints (ftorWithCallback);
684  }
685 
686  return ftor.nextOrdinal ();
687 }
688 
689 QPointF CoordSystem::positionGraph (const QString &pointIdentifier) const
690 {
691  QString curveName = Point::curveNameFromPointIdentifier (pointIdentifier);
692 
693  const Curve *curve = curveForCurveName (curveName);
694  return curve->positionGraph (pointIdentifier);
695 }
696 
697 QPointF CoordSystem::positionScreen (const QString &pointIdentifier) const
698 {
699  QString curveName = Point::curveNameFromPointIdentifier (pointIdentifier);
700 
701  const Curve *curve = curveForCurveName (curveName);
702  return curve->positionScreen (pointIdentifier);
703 }
704 
705 void CoordSystem::print () const
706 {
707  QString text;
708  QTextStream str (&text);
709 
710  printStream ("",
711  str);
712  std::cerr << text.toLatin1().data();
713 }
714 
715 void CoordSystem::printStream (QString indentation,
716  QTextStream &str) const
717 {
718  str << indentation << "Graph\n";
719 
720  indentation += INDENTATION_DELTA;
721 
722  // str << indentation << "name=" << m_name << "\n";
723  // str << indentation << "pixmap=" << m_pixmap.width() << "x" << m_pixmap.height() << "\n";
724 
725  m_curveAxes->printStream (indentation,
726  str);
727  m_curvesGraphs.printStream (indentation,
728  str);
729 
730  m_modelAxesChecker.printStream (indentation,
731  str);
732  m_modelCoords.printStream (indentation,
733  str);
734  m_modelDigitizeCurve.printStream (indentation,
735  str);
736  m_modelExport.printStream (indentation,
737  str);
738  m_modelGeneral.printStream (indentation,
739  str);
740  m_modelGridDisplay.printStream (indentation,
741  str);
742  m_modelGridRemoval.printStream (indentation,
743  str);
744  m_modelPointMatch.printStream (indentation,
745  str);
746  m_modelSegments.printStream (indentation,
747  str);
748 }
749 
751 {
752  ENGAUGE_ASSERT (!m_successfulRead);
753 
754  return m_reasonForUnsuccessfulRead;
755 }
756 
757 void CoordSystem::removePointAxis (const QString &identifier)
758 {
759  LOG4CPP_INFO_S ((*mainCat)) << "CoordSystem::removePointAxis identifier=" << identifier.toLatin1 ().data ();
760 
761  m_curveAxes->removePoint (identifier);
762 }
763 
764 void CoordSystem::removePointGraph (const QString &identifier)
765 {
766  LOG4CPP_INFO_S ((*mainCat)) << "CoordSystem::removePointGraph identifier=" << identifier.toLatin1 ().data ();
767 
768  m_curvesGraphs.removePoint (identifier);
769 }
770 
772 {
774 
775  Functor2wRet<const QString &, const Point &, CallbackSearchReturn> ftorWithCallback = functor_ret (ftor,
777 
778  curvesGraphs.iterateThroughCurvesPoints (ftorWithCallback);
779 }
780 
781 void CoordSystem::resetSelectedCurveNameIfNecessary ()
782 {
783  if (m_selectedCurveName.isEmpty () ||
784  curveForCurveName (m_selectedCurveName) == 0) {
785 
786  // Selected curve name is empty, or the curve has been removed so we pick another. The first is arbitrarily picked
787  m_selectedCurveName = m_curvesGraphs.curvesGraphsNames().first();
788  }
789 
790 }
791 
792 void CoordSystem::saveXml (QXmlStreamWriter &writer) const
793 {
794  writer.writeStartElement(DOCUMENT_SERIALIZE_COORD_SYSTEM);
795 
796  // Serialize the Document variables
797  m_modelGeneral.saveXml (writer);
798  m_modelCoords.saveXml (writer);
799  m_modelDigitizeCurve.saveXml (writer);
800  m_modelExport.saveXml (writer);
801  m_modelAxesChecker.saveXml (writer);
802  m_modelGridDisplay.saveXml (writer);
803  m_modelGridRemoval.saveXml (writer);
804  m_modelPointMatch.saveXml (writer);
805  m_modelSegments.saveXml (writer);
806  m_curveAxes->saveXml (writer);
807  m_curvesGraphs.saveXml (writer);
808  writer.writeEndElement();
809 }
810 
812 {
813  return m_selectedCurveName;
814 }
815 
816 void CoordSystem::setCurveAxes (const Curve &curveAxes)
817 {
818  LOG4CPP_INFO_S ((*mainCat)) << "CoordSystem::setCurveAxes";
819 
820  if (m_curveAxes != 0) {
821  delete m_curveAxes;
822  m_curveAxes = 0;
823  }
824 
825  m_curveAxes = new Curve (curveAxes);
826 }
827 
828 void CoordSystem::setCurvesGraphs (const CurvesGraphs &curvesGraphs)
829 {
830  LOG4CPP_INFO_S ((*mainCat)) << "CoordSystem::setCurvesGraphs";
831 
832  m_curvesGraphs = curvesGraphs;
833 
834  resetSelectedCurveNameIfNecessary ();
835 }
836 
838 {
839  m_modelAxesChecker = modelAxesChecker;
840 }
841 
843 {
844  // Save the CurveFilter for each Curve
845  ColorFilterSettingsList::const_iterator itr;
846  for (itr = modelColorFilter.colorFilterSettingsList().constBegin ();
847  itr != modelColorFilter.colorFilterSettingsList().constEnd();
848  itr++) {
849 
850  QString curveName = itr.key();
851  const ColorFilterSettings &colorFilterSettings = itr.value();
852 
853  Curve *curve = curveForCurveName (curveName);
854  curve->setColorFilterSettings (colorFilterSettings);
855  }
856 }
857 
859 {
860  m_modelCoords = modelCoords;
861 }
862 
863 void CoordSystem::setModelCurveStyles(const CurveStyles &modelCurveStyles)
864 {
865  // Save the LineStyle and PointStyle for each Curve
866  QStringList curveNames = modelCurveStyles.curveNames();
867  QStringList::iterator itr;
868  for (itr = curveNames.begin(); itr != curveNames.end(); itr++) {
869 
870  QString curveName = *itr;
871  const CurveStyle &curveStyle = modelCurveStyles.curveStyle (curveName);
872 
873  Curve *curve = curveForCurveName (curveName);
874  curve->setCurveStyle (curveStyle);
875  }
876 }
877 
879 {
880  m_modelDigitizeCurve = modelDigitizeCurve;
881 }
882 
884 {
885  m_modelExport = modelExport;
886 }
887 
889 {
890  m_modelGeneral = modelGeneral;
891 }
892 
894 {
895  m_modelGridDisplay = modelGridDisplay;
896 }
897 
899 {
900  m_modelGridRemoval = modelGridRemoval;
901 }
902 
904 {
905  m_modelPointMatch = modelPointMatch;
906 }
907 
909 {
910  m_modelSegments = modelSegments;
911 }
912 
913 void CoordSystem::setSelectedCurveName(const QString &selectedCurveName)
914 {
915  m_selectedCurveName = selectedCurveName;
916 }
917 
919 {
920  return m_successfulRead;
921 }
922 
924 {
925  LOG4CPP_INFO_S ((*mainCat)) << "CoordSystem::updatePointOrdinals";
926 
927  // The graph coordinates of all points in m_curvesGraphs must have already been updated at this point. See applyTransformation
928  m_curvesGraphs.updatePointOrdinals (transformation);
929 }
void loadVersion6(QXmlStreamReader &reader)
Load from file in version 6 format.
virtual DocumentModelSegments modelSegments() const
Get method for DocumentModelSegments.
void setPointsSelectionFunctions(ExportPointsSelectionFunctions exportPointsSelectionFunctions)
Set method for point selection for functions.
CallbackSearchReturn callback(const QString &curveName, const Point &point)
Callback method.
void removePoint(const QString &identifier)
Perform the opposite of addPointAtEnd.
Definition: Curve.cpp:452
QStringList curveNames() const
List of all curve names.
Definition: CurveStyles.cpp:67
Manage storage and retrieval of the settings for the curves.
QPointF positionScreen(const QString &pointIdentifier) const
Return the position, in screen coordinates, of the specified Point.
Definition: Curve.cpp:415
Model for DlgSettingsGeneral and CmdSettingsGeneral.
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 saveXml(QXmlStreamWriter &writer) const
Serialize curves.
QString errorMessage() const
Error message that explains the problem indicated by isError.
void setStartX(double startX)
Set method for x grid line lower bound (inclusive).
virtual void saveXml(QXmlStreamWriter &writer) const
Save entire model as xml into stream.
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...
virtual QString reasonForUnsuccessfulRead() const
Return an informative text message explaining why startup loading failed. Applies if successfulRead r...
static LineStyle defaultGraphCurve(int index)
Initial default for index&#39;th graph curve.
Definition: LineStyle.cpp:84
Model for DlgSettingsGridDisplay and CmdSettingsGridDisplay.
void printStream(QString indentation, QTextStream &str) const
Debugging method that supports print method of this class and printStream method of some other class(...
void loadXml(QXmlStreamReader &reader)
Load from serialized xml post-version 5 file.
virtual void setModelAxesChecker(const DocumentModelAxesChecker &modelAxesChecker)
Set method for DocumentModelAxesChecker.
virtual void saveXml(QXmlStreamWriter &writer) const
Save entire model as xml into stream.
Callback that is used when iterating through a read-only CurvesGraphs to remove corresponding points ...
void printStream(QString indentation, QTextStream &str) const
Debugging method that supports print method of this class and printStream method of some other class(...
virtual DocumentModelPointMatch modelPointMatch() const
Get method for DocumentModelPointMatch.
void setCurveStyle(const CurveStyle &curveStyle)
Set curve style.
Definition: Curve.cpp:505
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 void saveXml(QXmlStreamWriter &writer) const
Save entire model as xml into stream.
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 setMinLength(double minLength)
Set method for min length.
void loadPreVersion6(QDataStream &str, double version)
Load from file in pre-version 6 format.
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.
void setColorFilterSettings(const ColorFilterSettings &colorFilterSettings)
Set color filter.
Definition: Curve.cpp:488
virtual void saveXml(QXmlStreamWriter &writer) const
Save entire model as xml into stream.
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.
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 setStopY(double stopY)
Set method for y stop.
virtual void loadXml(QXmlStreamReader &reader)
Load model from serialized xml.
Curve * curveForCurveName(const QString &curveName)
Return the axis or graph curve for the specified curve name.
void printStream(QString indentation, QTextStream &str) const
Debugging method that supports print method of this class and printStream method of some other class(...
virtual DocumentModelCoords modelCoords() const
Get method for DocumentModelCoords.
int numCurves() const
Current number of graphs curves.
QString errorMessage() const
Error message that explains the problem indicated by isError.
int numPoints() const
Number of points.
Definition: Curve.cpp:374
void printStream(QString indentation, QTextStream &str) const
Debugging method that supports print method of this class and printStream method of some other class(...
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 bool successfulRead() const
Return true if startup loading succeeded. If the loading failed then reasonForUnsuccessfulRed will ex...
virtual void updatePointOrdinals(const Transformation &transformation)
Update point ordinals after point addition/removal or dragging.
virtual void setModelExport(const DocumentModelExportFormat &modelExport)
Set method for DocumentModelExportFormat.
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:226
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.
void setStartY(double startY)
Set method for y start.
void setStepY(double stepY)
Set method for y step.
virtual DocumentModelDigitizeCurve modelDigitizeCurve() const
Get method for DocumentModelDigitizeCurve.
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.
QPointF positionGraph(const QString &pointIdentifier) const
Return the position, in graph coordinates, of the specified Point.
Definition: Curve.cpp:398
virtual void loadXml(QXmlStreamReader &reader)
Load model from serialized xml.
virtual DocumentModelGeneral modelGeneral() const
Get method for DocumentModelGeneral.
bool isError() const
True if an error occurred during iteration.
QString defaultCurveName(int indexOneBased, const QString &defaultName) const
Default graph name for the specified curve index.
Callback for sanity checking the screen and graph coordinates of an axis point that is in the axes cu...
void setDelimiter(ExportDelimiter exportDelimiter)
Set method for delimiter.
void setStartX(double startX)
Set method for x start.
void printStream(QString indentation, QTextStream &str) const
Debugging method that supports print method of this class and printStream method of some other class(...
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
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.
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
virtual void loadXml(QXmlStreamReader &reader)
Load model from serialized xml.
QString identifier() const
Unique identifier for a specific Point.
Definition: Point.cpp:256
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...
virtual void saveXml(QXmlStreamWriter &writer) const
Save graph to xml.
double nextOrdinal() const
Computed next ordinal.
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:365
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.
void setStable(bool stable)
Set method for stable flag.
virtual void setModelGeneral(const DocumentModelGeneral &modelGeneral)
Set method for DocumentModelGeneral.
Model for DlgSettingsDigitizeCurve and CmdSettingsDigitizeCurve.
virtual void setCurvesGraphs(const CurvesGraphs &curvesGraphs)
Let CmdAbstract classes overwrite CurvesGraphs. Applies to current coordinate system.
virtual void saveXml(QXmlStreamWriter &writer) const
Save entire model as xml into stream.
Affine transformation between screen and graph coordinates, based on digitized axis points...
virtual DocumentModelAxesChecker modelAxesChecker() const
Get method for DocumentModelAxesChecker.
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.
virtual void print() const
Debugging method for printing directly from symbolic debugger.
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 int nextOrdinalForCurve(const QString &curveName) const
Default next ordinal value for specified curve.
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.
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 removePointsInCurvesGraphs(CurvesGraphs &curvesGraphs)
Remove all points identified in the specified CurvesGraphs. See also addPointsInCurvesGraphs.
bool isXOnly(const QString &pointIdentifier) const
Return true if y coordinate is undefined, otherwise x coordinae is undefined in DOCUMENT_AXES_POINT_R...
virtual CurveStyles modelCurveStyles() const
Get method for CurveStyles.
virtual const CurvesGraphs & curvesGraphs() const
Make all Curves available, read only, for CmdAbstract classes only.
virtual void loadXml(QXmlStreamReader &reader)
Load model from serialized xml.
virtual void setModelColorFilter(const DocumentModelColorFilter &modelColorFilter)
Set method for DocumentModelColorFilter.
void iterateThroughCurvePoints(const Functor2wRet< const QString &, const Point &, CallbackSearchReturn > &ftorWithCallback) const
Apply functor to Points on Curve.
Definition: Curve.cpp:243
void setCoordUnitsTheta(CoordUnitsPolarTheta coordUnits)
Set method for theta units.
void setRemoveDefinedGridLines(bool removeDefinedGridLines)
Set method for removing defined grid lines.
virtual int curvesGraphsNumPoints(const QString &curveName) const
See CurvesGraphs::curvesGraphsNumPoints.
virtual void removePointGraph(const QString &identifier)
Perform the opposite of addPointGraph.
CoordsType coordsType() const
Get method for coordinates type.
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.
virtual QStringList curvesGraphsNames() const
See CurvesGraphs::curvesGraphsNames.
int curvesGraphsNumPoints(const QString &curveName) const
Point count.
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.
virtual const Curve & curveAxes() const
Get method for axis curve.
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.
virtual void printStream(QString indentation, QTextStream &str) const
Debugging method that supports print method of this class and printStream method of some other class(...
void setCoordUnitsRadius(CoordUnitsNonPolarTheta coordUnits)
Set method for radius units.
void setGridCoordDisableX(GridCoordDisable gridCoordDisable)
Set method for x coord parameter to disable.
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.
virtual QString selectedCurveName() const
Currently selected curve name. This is used to set the selected curve combobox in MainWindow...
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
void setStable()
Set the stable flag to true. This public version has no argument since it cannot be undone...
virtual void saveXml(QXmlStreamWriter &writer) const
Save entire model as xml into stream.
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...
CurveStyle curveStyle(const QString &curveName) const
CurveStyle in specified curve.
Definition: CurveStyles.cpp:79
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 movePoint(const QString &pointIdentifier, const QPointF &deltaScreen)
See Curve::movePoint.
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 DocumentModelGridDisplay modelGridDisplay() const
Get method for DocumentModelGridDisplay.
virtual DocumentModelColorFilter modelColorFilter() const
Get method for DocumentModelColorFilter.
virtual void iterateThroughCurvesPointsGraphs(const Functor2wRet< const QString &, const Point &, CallbackSearchReturn > &ftorWithCallback)
See Curve::iterateThroughCurvePoints, for all the graphs curves.
virtual void saveXml(QXmlStreamWriter &writer) const
Save entire model as xml into stream.
Model for DlgSettingsSegments and CmdSettingsSegments.
void loadPreVersion6(QDataStream &str)
Load from serialized binary pre-version 6 file.
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.
virtual QPointF positionScreen(const QString &pointIdentifier) const
See Curve::positionScreen.
QStringList curvesGraphsNames() const
List of graph curve names.
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 ...
void removePoint(const QString &pointIdentifier)
Remove the Point from its Curve.
const ColorFilterSettingsList & colorFilterSettingsList() const
Get method for copying all color filters in one step.
virtual void iterateThroughCurveSegments(const QString &curveName, const Functor2wRet< const Point &, const Point &, CallbackSearchReturn > &ftorWithCallback) const
See Curve::iterateThroughCurveSegments, for any axes or graph curve.
virtual DocumentModelGridRemoval modelGridRemoval() const
Get method for DocumentModelGridRemoval.
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
Model for DlgSettingsGridRemoval and CmdSettingsGridRemoval. The settings are unstable until the user...
void saveXml(QXmlStreamWriter &writer) const
Serialize curve.
Definition: Curve.cpp:465
void printStream(QString indentation, QTextStream &str) const
Debugging method that supports print method of this class and printStream method of some other class(...
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.
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(...
virtual DocumentModelExportFormat modelExport() const
Get method for DocumentModelExportFormat.
CoordSystem(DocumentAxesPointsRequired documentAxesPointsRequired)
Single constructor.
Definition: CoordSystem.cpp:38
void printStream(QString indentation, QTextStream &str) const
Debugging method that supports print method of this class and printStream method of some other class(...
void printStream(QString indentation, QTextStream &str) const
Debugging method that supports print method of this class and printStream method of some other class(...
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 setXLabel(const QString &xLabel)
Set method for x label.
virtual void setModelDigitizeCurve(const DocumentModelDigitizeCurve &modelDigitizeCurve)
Set method for DocumentModelDigitizeCurve.
void setCoordsType(CoordsType coordsType)
Set method for coordinates type.