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 
49  // Create one curve, or as many curve as specified in the configuration file, whichever is greater
50  for (int indexOneBased = 1; indexOneBased <= settingsForGraph.numberOfCurvesForImport (); indexOneBased++) {
51 
52  QString curveName = settingsForGraph.defaultCurveName (indexOneBased,
53  DEFAULT_GRAPH_CURVE_NAME);
54  m_curvesGraphs.addGraphCurveAtEnd (Curve (curveName,
57  PointStyle::defaultGraphCurve (m_curvesGraphs.numCurves ()))));
58 
59  resetSelectedCurveNameIfNecessary ();
60  }
61 }
62 
63 void CoordSystem::addGraphCurveAtEnd (const QString &curveName)
64 {
65  m_curvesGraphs.addGraphCurveAtEnd (Curve (curveName,
68  PointStyle::defaultGraphCurve(m_curvesGraphs.numCurves()))));
69 
70  resetSelectedCurveNameIfNecessary ();
71 }
72 
73 void CoordSystem::addPointAxisWithGeneratedIdentifier (const QPointF &posScreen,
74  const QPointF &posGraph,
75  QString &identifier,
76  double ordinal,
77  bool isXOnly)
78 {
79  Point point (AXIS_CURVE_NAME,
80  posScreen,
81  posGraph,
82  ordinal,
83  isXOnly);
84  m_curveAxes->addPoint (point);
85 
86  identifier = point.identifier();
87 
88  LOG4CPP_INFO_S ((*mainCat)) << "CoordSystem::addPointAxisWithGeneratedIdentifier"
89  << " ordinal=" << ordinal
90  << " posScreen=" << QPointFToString (posScreen).toLatin1 ().data ()
91  << " posGraph=" << QPointFToString (posGraph).toLatin1 ().data ()
92  << " identifier=" << identifier.toLatin1 ().data ();
93 }
94 
95 void CoordSystem::addPointAxisWithSpecifiedIdentifier (const QPointF &posScreen,
96  const QPointF &posGraph,
97  const QString &identifier,
98  double ordinal,
99  bool isXOnly)
100 {
101  Point point (AXIS_CURVE_NAME,
102  identifier,
103  posScreen,
104  posGraph,
105  ordinal,
106  isXOnly);
107  m_curveAxes->addPoint (point);
108 
109  LOG4CPP_INFO_S ((*mainCat)) << "CoordSystem::addPointAxisWithSpecifiedIdentifier"
110  << " ordinal=" << ordinal
111  << " posScreen=" << QPointFToString (posScreen).toLatin1 ().data ()
112  << " posGraph=" << QPointFToString (posGraph).toLatin1 ().data ()
113  << " identifier=" << identifier.toLatin1 ().data ();
114 }
115 
117  const QPointF &posScreen,
118  QString &identifier,
119  double ordinal)
120 {
121  Point point (curveName,
122  posScreen,
123  ordinal);
124  m_curvesGraphs.addPoint (point);
125 
126  identifier = point.identifier();
127 
128  LOG4CPP_INFO_S ((*mainCat)) << "CoordSystem::addPointGraphWithGeneratedIdentifier"
129  << " ordinal=" << ordinal
130  << " posScreen=" << QPointFToString (posScreen).toLatin1 ().data ()
131  << " identifier=" << identifier.toLatin1 ().data ();
132 }
133 
135  const QPointF &posScreen,
136  const QString &identifier,
137  double ordinal)
138 {
139  Point point (curveName,
140  identifier,
141  posScreen,
142  ordinal);
143  m_curvesGraphs.addPoint (point);
144 
145  LOG4CPP_INFO_S ((*mainCat)) << "CoordSystem::addPointGraphWithSpecifiedIdentifier"
146  << " ordinal=" << ordinal
147  << " posScreen=" << QPointFToString (posScreen).toLatin1 ().data ()
148  << " identifier=" << identifier.toLatin1 ().data ();
149 }
150 
152 {
153  CallbackAddPointsInCurvesGraphs ftor (*this);
154 
155  Functor2wRet<const QString &, const Point &, CallbackSearchReturn> ftorWithCallback = functor_ret (ftor,
157 
158  curvesGraphs.iterateThroughCurvesPoints (ftorWithCallback);
159 }
160 
161 bool CoordSystem::bytesIndicatePreVersion6 (const QByteArray &bytes) const
162 {
163  QByteArray preVersion6MagicNumber;
164  preVersion6MagicNumber.resize (FOUR_BYTES);
165 
166  // Windows compiler gives warning if 0x## is used instead of '\x##' below
167  preVersion6MagicNumber[0] = '\x00';
168  preVersion6MagicNumber[1] = '\x00';
169  preVersion6MagicNumber[2] = '\xCA';
170  preVersion6MagicNumber[3] = '\xFE';
171 
172  return (bytes == preVersion6MagicNumber);
173 }
174 
175 void CoordSystem::checkAddPointAxis (const QPointF &posScreen,
176  const QPointF &posGraph,
177  bool &isError,
178  QString &errorMessage,
179  bool isXOnly)
180 {
181  LOG4CPP_INFO_S ((*mainCat)) << "CoordSystem::checkAddPointAxis"
182  << " posScreen=" << QPointFToString (posScreen).toLatin1 ().data ()
183  << " posGraph=" << QPointFToString (posGraph).toLatin1 ().data ();
184 
185  CallbackCheckAddPointAxis ftor (m_modelCoords,
186  posScreen,
187  posGraph,
188  m_documentAxesPointsRequired,
189  isXOnly);
190 
191  Functor2wRet<const QString &, const Point &, CallbackSearchReturn> ftorWithCallback = functor_ret (ftor,
193  m_curveAxes->iterateThroughCurvePoints (ftorWithCallback);
194 
195  isError = ftor.isError ();
196  errorMessage = ftor.errorMessage ();
197 }
198 
199 void CoordSystem::checkEditPointAxis (const QString &pointIdentifier,
200  const QPointF &posScreen,
201  const QPointF &posGraph,
202  bool &isError,
203  QString &errorMessage)
204 {
205  LOG4CPP_INFO_S ((*mainCat)) << "CoordSystem::checkEditPointAxis"
206  << " posGraph=" << QPointFToString (posGraph).toLatin1 ().data ();
207 
208  CallbackCheckEditPointAxis ftor (m_modelCoords,
209  pointIdentifier,
210  posScreen,
211  posGraph,
212  m_documentAxesPointsRequired);
213 
214  Functor2wRet<const QString &, const Point &, CallbackSearchReturn> ftorWithCallback = functor_ret (ftor,
216  m_curveAxes->iterateThroughCurvePoints (ftorWithCallback);
217 
218  isError = ftor.isError ();
219  errorMessage = ftor.errorMessage ();
220 }
221 
223 {
224  ENGAUGE_CHECK_PTR (m_curveAxes);
225 
226  return *m_curveAxes;
227 }
228 
229 Curve *CoordSystem::curveForCurveName (const QString &curveName)
230 {
231  if (curveName == AXIS_CURVE_NAME) {
232 
233  return m_curveAxes;
234 
235  } else {
236 
237  return m_curvesGraphs.curveForCurveName (curveName);
238 
239  }
240 }
241 
242 const Curve *CoordSystem::curveForCurveName (const QString &curveName) const
243 {
244  if (curveName == AXIS_CURVE_NAME) {
245 
246  return m_curveAxes;
247 
248  } else {
249 
250  return m_curvesGraphs.curveForCurveName (curveName);
251 
252  }
253 }
254 
256 {
257  return m_curvesGraphs;
258 }
259 
261 {
262  return m_curvesGraphs.curvesGraphsNames();
263 }
264 
265 int CoordSystem::curvesGraphsNumPoints(const QString &curveName) const
266 {
267  return m_curvesGraphs.curvesGraphsNumPoints(curveName);
268 }
269 
270 DocumentAxesPointsRequired CoordSystem::documentAxesPointsRequired () const
271 {
272  return m_documentAxesPointsRequired;
273 }
274 
275 void CoordSystem::editPointAxis (const QPointF &posGraph,
276  const QString &identifier)
277 {
278  LOG4CPP_INFO_S ((*mainCat)) << "CoordSystem::editPointAxis"
279  << " posGraph=(" << posGraph.x () << ", " << posGraph.y () << ") identifier="
280  << " identifier=" << identifier.toLatin1 ().data ();
281 
282  m_curveAxes->editPointAxis (posGraph,
283  identifier);
284 }
285 
287  bool isY,
288  double x,
289  double y,
290  const QStringList &identifiers,
291  const Transformation &transformation)
292 {
293  LOG4CPP_INFO_S ((*mainCat)) << "CoordSystem::editPointGraph posGraph=("
294  << " x=" << (isX ? QString::number (x).toLatin1().data() : "")
295  << " y=" << (isY ? QString::number (y).toLatin1().data() : "")
296  << ") identifiers=" << identifiers.join(" ").toLatin1 ().data ();
297 
298  m_curvesGraphs.editPointGraph (isX,
299  isY,
300  x,
301  y,
302  identifiers,
303  transformation);
304 }
305 
306 bool CoordSystem::isXOnly (const QString &pointIdentifier) const
307 {
308  return m_curveAxes->isXOnly (pointIdentifier);
309 }
310 
311 void CoordSystem::iterateThroughCurvePointsAxes (const Functor2wRet<const QString &, const Point &, CallbackSearchReturn> &ftorWithCallback)
312 {
313  ENGAUGE_CHECK_PTR (m_curveAxes);
314 
315  m_curveAxes->iterateThroughCurvePoints (ftorWithCallback);
316 }
317 
318 void CoordSystem::iterateThroughCurvePointsAxes (const Functor2wRet<const QString &, const Point &, CallbackSearchReturn> &ftorWithCallback) const
319 {
320  ENGAUGE_CHECK_PTR (m_curveAxes);
321 
322  m_curveAxes->iterateThroughCurvePoints (ftorWithCallback);
323 }
324 
325 void CoordSystem::iterateThroughCurveSegments (const QString &curveName,
326  const Functor2wRet<const Point &, const Point &, CallbackSearchReturn> &ftorWithCallback) const
327 {
328  if (curveName == AXIS_CURVE_NAME) {
329  m_curveAxes->iterateThroughCurveSegments(ftorWithCallback);
330  } else {
331  m_curvesGraphs.iterateThroughCurveSegments(curveName,
332  ftorWithCallback);
333  }
334 }
335 
336 void CoordSystem::iterateThroughCurvesPointsGraphs (const Functor2wRet<const QString &, const Point &, CallbackSearchReturn> &ftorWithCallback)
337 {
338  ENGAUGE_CHECK_PTR (m_curveAxes);
339 
340  m_curvesGraphs.iterateThroughCurvesPoints (ftorWithCallback);
341 }
342 
343 void CoordSystem::iterateThroughCurvesPointsGraphs (const Functor2wRet<const QString &, const Point &, CallbackSearchReturn> &ftorWithCallback) const
344 {
345  ENGAUGE_CHECK_PTR (m_curveAxes);
346 
347  m_curvesGraphs.iterateThroughCurvesPoints (ftorWithCallback);
348 }
349 
350 bool CoordSystem::loadCurvesFile(const QString & /* curvesFile */)
351 {
352  LOG4CPP_INFO_S ((*mainCat)) << "CoordSystem::loadCurvesFile";
353 
354  return true;
355 }
356 
357 void CoordSystem::loadPreVersion6 (QDataStream &str,
358  double version)
359 {
360  LOG4CPP_INFO_S ((*mainCat)) << "CoordSystem::loadPreVersion6";
361 
362  qint32 int32;
363  double dbl, radius = 0.0;
364  QString st;
365 
366  str >> st; // CurveCmbText selection
367  str >> st; // MeasureCmbText selection
368  str >> int32;
369  m_modelCoords.setCoordsType((CoordsType) int32);
370  if (version >= 3) {
371  str >> (double &) radius;
372  }
373  m_modelCoords.setOriginRadius(radius);
374  str >> int32;
375  m_modelCoords.setCoordUnitsRadius(COORD_UNITS_NON_POLAR_THETA_NUMBER);
376  m_modelCoords.setCoordUnitsTheta((CoordUnitsPolarTheta) int32);
377  str >> int32;
378  m_modelCoords.setCoordScaleXTheta((CoordScale) int32);
379  str >> int32;
380  m_modelCoords.setCoordScaleYRadius((CoordScale) int32);
381 
382  str >> int32;
383  m_modelExport.setDelimiter((ExportDelimiter) int32);
384  str >> int32;
385  m_modelExport.setLayoutFunctions((ExportLayoutFunctions) int32);
386  str >> int32;
387  m_modelExport.setPointsSelectionFunctions((ExportPointsSelectionFunctions) int32);
388  m_modelExport.setPointsSelectionRelations(EXPORT_POINTS_SELECTION_RELATIONS_RAW); // Best for maps
389  m_modelExport.setPointsIntervalUnitsFunctions((ExportPointsIntervalUnits) int32);
390  m_modelExport.setPointsIntervalUnitsRelations((ExportPointsIntervalUnits) int32);
391  str >> int32;
392  m_modelExport.setHeader((ExportHeader) int32);
393  if (version >= 5.1) {
394  str >> st; // X label
395  if (m_modelCoords.coordsType() == COORDS_TYPE_CARTESIAN) {
396  m_modelExport.setXLabel(st);
397  }
398  str >> st; // Theta label
399  if (m_modelCoords.coordsType() == COORDS_TYPE_POLAR) {
400  m_modelExport.setXLabel(st);
401  }
402  }
403 
404  // Stable flag in m_modelGridRemoval is set below after points are read in
405  str >> int32; // Remove thin lines parallel to axes
406  str >> dbl; // Thin thickness
407  str >> int32;
408  m_modelGridRemoval.setRemoveDefinedGridLines(int32);
409  str >> int32; // Initialized
410  str >> int32;
411  m_modelGridRemoval.setCountX(int32);
412  str >> int32;
413  m_modelGridRemoval.setCountY(int32);
414  str >> int32;
415  m_modelGridRemoval.setGridCoordDisableX((GridCoordDisable) int32);
416  str >> int32;
417  m_modelGridRemoval.setGridCoordDisableY((GridCoordDisable) int32);
418  str >> dbl;
419  m_modelGridRemoval.setStartX(dbl);
420  str >> dbl;
421  m_modelGridRemoval.setStartY(dbl);
422  str >> dbl;
423  m_modelGridRemoval.setStepX(dbl);
424  str >> dbl;
425  m_modelGridRemoval.setStepY(dbl);
426  str >> dbl;
427  m_modelGridRemoval.setStopX(dbl);
428  str >> dbl;
429  m_modelGridRemoval.setStopY(dbl);
430  str >> dbl;
431  m_modelGridRemoval.setCloseDistance(dbl);
432  str >> int32; // Boolean remove color flag
433  if (version >= 5) {
434  QColor color;
435  str >> color;
436  } else {
437  str >> int32; // Rgb color
438  }
439  str >> int32; // Foreground threshold low
440  str >> int32; // Foreground threshold high
441  str >> dbl; // Gap separation
442 
443  str >> int32;
444  m_modelGridDisplay.setStable(int32);
445  str >> int32;
446  m_modelGridDisplay.setCountX(int32);
447  str >> int32;
448  m_modelGridDisplay.setCountY(int32);
449  str >> int32;
450  m_modelGridDisplay.setDisableX((GridCoordDisable) int32);
451  str >> int32;
452  m_modelGridDisplay.setDisableY((GridCoordDisable) int32);
453  str >> dbl;
454  m_modelGridDisplay.setStartX (dbl);
455  str >> dbl;
456  m_modelGridDisplay.setStartY (dbl);
457  str >> dbl;
458  m_modelGridDisplay.setStepX (dbl);
459  str >> dbl;
460  m_modelGridDisplay.setStepY (dbl);
461  str >> dbl;
462  m_modelGridDisplay.setStopX (dbl);
463  str >> dbl;
464  m_modelGridDisplay.setStopY (dbl);
465 
466  str >> int32;
467  m_modelSegments.setMinLength(int32);
468  str >> int32;
469  m_modelSegments.setPointSeparation(int32);
470  str >> int32;
471  m_modelSegments.setLineWidth(int32);
472  str >> int32;
473  m_modelSegments.setLineColor((ColorPalette) int32);
474 
475  str >> int32; // Point separation
476  str >> int32;
477  m_modelPointMatch.setMaxPointSize(int32);
478  str >> int32;
479  m_modelPointMatch.setPaletteColorAccepted((ColorPalette) int32);
480  str >> int32;
481  m_modelPointMatch.setPaletteColorRejected((ColorPalette) int32);
482  if (version < 4) {
483  m_modelPointMatch.setPaletteColorCandidate(COLOR_PALETTE_BLUE);
484  } else {
485  str >> int32;
486  m_modelPointMatch.setPaletteColorCandidate((ColorPalette) int32);
487  }
488 
489  str >> int32; // Discretize method
490  str >> int32; // Intensity threshold low
491  str >> int32; // Intensity threshold high
492  str >> int32; // Foreground threshold low
493  str >> int32; // Foreground threshold high
494  str >> int32; // Hue threshold low
495  str >> int32; // Hue threshold high
496  str >> int32; // Saturation threshold low
497  str >> int32; // Saturation threshold high
498  str >> int32; // Value threshold low
499  str >> int32; // Value threshold high
500 
501  // Old versions have two Curve objects for 3 point axes and 2 point scales. New version picks one Curve
502  Curve *curveAxesIn = new Curve (str);
503  Curve *curveScaleIn = new Curve (str);
504  if (curveScaleIn->numPoints() == 2) {
505  // Nondefault case is map with scale bar
506  m_documentAxesPointsRequired = DOCUMENT_AXES_POINTS_REQUIRED_2;
507  m_curveAxes = curveScaleIn;
508  m_curveAxes->setCurveName (AXIS_CURVE_NAME); // Override existing "Scale" name
509  delete curveAxesIn;
510  } else {
511  // Default case is graph with axes
512  m_documentAxesPointsRequired = DOCUMENT_AXES_POINTS_REQUIRED_3;
513  m_curveAxes = curveAxesIn;
514  delete curveScaleIn;
515  }
516  m_curvesGraphs.loadPreVersion6 (str);
517 
518  // Information from curves and points can affect some data structures that were (mostly) set earlier
519  if (m_curveAxes->numPoints () >= m_documentAxesPointsRequired) {
520  m_modelGridRemoval.setStable();
521  }
522 
523  resetSelectedCurveNameIfNecessary ();
524 }
525 
526 void CoordSystem::loadVersion6 (QXmlStreamReader &reader)
527 {
528  LOG4CPP_INFO_S ((*mainCat)) << "CoordSystem::loadVersion6";
529 
530  m_documentAxesPointsRequired = DOCUMENT_AXES_POINTS_REQUIRED_3;
531 
532  // Import from xml. Loop to end of data or error condition occurs, whichever is first
533  while (!reader.atEnd() &&
534  !reader.hasError()) {
535  QXmlStreamReader::TokenType tokenType = loadNextFromReader(reader);
536 
537  if ((reader.name() == DOCUMENT_SERIALIZE_DOCUMENT) &&
538  (tokenType == QXmlStreamReader::EndElement)) {
539 
540  // Exit out of loop immediately
541  break;
542  }
543 
544  // Iterate to next StartElement
545  if (tokenType == QXmlStreamReader::StartElement) {
546 
547  // This is a StartElement, so process it
548  QString tag = reader.name().toString();
549  if (tag == DOCUMENT_SERIALIZE_AXES_CHECKER){
550  m_modelAxesChecker.loadXml (reader);
551  } else if (tag == DOCUMENT_SERIALIZE_COORDS) {
552  m_modelCoords.loadXml (reader);
553  } else if (tag == DOCUMENT_SERIALIZE_CURVE) {
554  m_curveAxes = new Curve (reader);
555  } else if (tag == DOCUMENT_SERIALIZE_CURVES_GRAPHS) {
556  m_curvesGraphs.loadXml (reader);
557  } else if (tag == DOCUMENT_SERIALIZE_DIGITIZE_CURVE) {
558  m_modelDigitizeCurve.loadXml (reader);
559  } else if (tag == DOCUMENT_SERIALIZE_EXPORT) {
560  m_modelExport.loadXml (reader);
561  } else if (tag == DOCUMENT_SERIALIZE_GENERAL || tag == DOCUMENT_SERIALIZE_COMMON) {
562  m_modelGeneral.loadXml (reader);
563  } else if (tag == DOCUMENT_SERIALIZE_GRID_REMOVAL) {
564  m_modelGridRemoval.loadXml (reader);
565  } else if (tag == DOCUMENT_SERIALIZE_IMAGE) {
566  ENGAUGE_ASSERT (false); // The image should have been read before this method was called
567  } else if (tag == DOCUMENT_SERIALIZE_POINT_MATCH) {
568  m_modelPointMatch.loadXml (reader);
569  } else if (tag == DOCUMENT_SERIALIZE_SEGMENTS) {
570  m_modelSegments.loadXml (reader);
571  } else {
572  m_successfulRead = false;
573  m_reasonForUnsuccessfulRead = QString ("%1 '%2' %3")
574  .arg (QObject::tr ("Unexpected xml token"))
575  .arg (tag)
576  .arg ("encountered");
577  break;
578  }
579  }
580  }
581 
582  resetSelectedCurveNameIfNecessary ();
583 }
584 
585 void CoordSystem::loadVersions7AndUp (QXmlStreamReader &reader,
586  DocumentAxesPointsRequired documentAxesPointsRequired)
587 {
588  LOG4CPP_INFO_S ((*mainCat)) << "CoordSystem::loadVersions7AndUp";
589 
590  m_documentAxesPointsRequired = documentAxesPointsRequired;
591 
592  // Import from xml. Loop to end of data or error condition occurs, whichever is first
593  while (!reader.atEnd() &&
594  !reader.hasError()) {
595  QXmlStreamReader::TokenType tokenType = loadNextFromReader(reader);
596 
597  if ((reader.name() == DOCUMENT_SERIALIZE_COORD_SYSTEM) &&
598  (tokenType == QXmlStreamReader::EndElement)) {
599 
600  // Exit out of loop immediately
601  break;
602  }
603 
604  // Iterate to next StartElement
605  if (tokenType == QXmlStreamReader::StartElement) {
606 
607  // This is a StartElement, so process it
608  QString tag = reader.name().toString();
609  if (tag == DOCUMENT_SERIALIZE_AXES_CHECKER){
610  m_modelAxesChecker.loadXml (reader);
611  } else if (tag == DOCUMENT_SERIALIZE_COORDS) {
612  m_modelCoords.loadXml (reader);
613  } else if (tag == DOCUMENT_SERIALIZE_CURVE) {
614  m_curveAxes = new Curve (reader);
615  } else if (tag == DOCUMENT_SERIALIZE_CURVES_GRAPHS) {
616  m_curvesGraphs.loadXml (reader);
617  } else if (tag == DOCUMENT_SERIALIZE_DIGITIZE_CURVE) {
618  m_modelDigitizeCurve.loadXml (reader);
619  } else if (tag == DOCUMENT_SERIALIZE_EXPORT) {
620  m_modelExport.loadXml (reader);
621  } else if (tag == DOCUMENT_SERIALIZE_GENERAL || tag == DOCUMENT_SERIALIZE_COMMON) {
622  m_modelGeneral.loadXml (reader);
623  } else if (tag == DOCUMENT_SERIALIZE_GRID_DISPLAY) {
624  m_modelGridDisplay.loadXml (reader);
625  } else if (tag == DOCUMENT_SERIALIZE_GRID_REMOVAL) {
626  m_modelGridRemoval.loadXml (reader);
627  } else if (tag == DOCUMENT_SERIALIZE_IMAGE) {
628  ENGAUGE_ASSERT (false); // The image should have been read before this method was called
629  } else if (tag == DOCUMENT_SERIALIZE_POINT_MATCH) {
630  m_modelPointMatch.loadXml (reader);
631  } else if (tag == DOCUMENT_SERIALIZE_SEGMENTS) {
632  m_modelSegments.loadXml (reader);
633  } else {
634  m_successfulRead = false;
635  m_reasonForUnsuccessfulRead = QString ("Unexpected xml token '%1' encountered").arg (tag);
636  break;
637  }
638  }
639  }
640 
641  resetSelectedCurveNameIfNecessary ();
642 }
643 
645 {
646  return m_modelAxesChecker;
647 }
648 
650 {
651  // Construct a curve-specific model
653 
654  return modelColorFilter;
655 }
656 
658 {
659  return m_modelCoords;
660 }
661 
663 {
664  // Construct a curve-specific model
666 
667  return modelCurveStyles;
668 }
669 
671 {
672  return m_modelDigitizeCurve;
673 }
674 
676 {
677  return m_modelExport;
678 }
679 
681 {
682  return m_modelGeneral;
683 }
684 
686 {
687  return m_modelGridDisplay;
688 }
689 
691 {
692  return m_modelGridRemoval;
693 }
694 
696 {
697  return m_modelPointMatch;
698 }
699 
701 {
702  return m_modelSegments;
703 }
704 
705 void CoordSystem::movePoint (const QString &pointIdentifier,
706  const QPointF &deltaScreen)
707 {
708  QString curveName = Point::curveNameFromPointIdentifier (pointIdentifier);
709 
710  Curve *curve = curveForCurveName (curveName);
711  ENGAUGE_ASSERT (curve != 0);
712  curve->movePoint (pointIdentifier,
713  deltaScreen);
714 }
715 
716 int CoordSystem::nextOrdinalForCurve (const QString &curveName) const
717 {
718  CallbackNextOrdinal ftor (curveName);
719 
720  Functor2wRet<const QString &, const Point &, CallbackSearchReturn> ftorWithCallback = functor_ret (ftor,
722 
723  if (curveName == AXIS_CURVE_NAME) {
724  m_curveAxes->iterateThroughCurvePoints (ftorWithCallback);
725  } else {
726  m_curvesGraphs.iterateThroughCurvesPoints (ftorWithCallback);
727  }
728 
729  return ftor.nextOrdinal ();
730 }
731 
732 QPointF CoordSystem::positionGraph (const QString &pointIdentifier) const
733 {
734  QString curveName = Point::curveNameFromPointIdentifier (pointIdentifier);
735 
736  const Curve *curve = curveForCurveName (curveName);
737  return curve->positionGraph (pointIdentifier);
738 }
739 
740 QPointF CoordSystem::positionScreen (const QString &pointIdentifier) const
741 {
742  QString curveName = Point::curveNameFromPointIdentifier (pointIdentifier);
743 
744  const Curve *curve = curveForCurveName (curveName);
745  return curve->positionScreen (pointIdentifier);
746 }
747 
748 void CoordSystem::print () const
749 {
750  QString text;
751  QTextStream str (&text);
752 
753  printStream ("",
754  str);
755  std::cerr << text.toLatin1().data();
756 }
757 
758 void CoordSystem::printStream (QString indentation,
759  QTextStream &str) const
760 {
761  str << indentation << "Graph\n";
762 
763  indentation += INDENTATION_DELTA;
764 
765  // str << indentation << "name=" << m_name << "\n";
766  // str << indentation << "pixmap=" << m_pixmap.width() << "x" << m_pixmap.height() << "\n";
767 
768  m_curveAxes->printStream (indentation,
769  str);
770  m_curvesGraphs.printStream (indentation,
771  str);
772 
773  m_modelAxesChecker.printStream (indentation,
774  str);
775  m_modelCoords.printStream (indentation,
776  str);
777  m_modelDigitizeCurve.printStream (indentation,
778  str);
779  m_modelExport.printStream (indentation,
780  str);
781  m_modelGeneral.printStream (indentation,
782  str);
783  m_modelGridDisplay.printStream (indentation,
784  str);
785  m_modelGridRemoval.printStream (indentation,
786  str);
787  m_modelPointMatch.printStream (indentation,
788  str);
789  m_modelSegments.printStream (indentation,
790  str);
791 }
792 
794 {
795  ENGAUGE_ASSERT (!m_successfulRead);
796 
797  return m_reasonForUnsuccessfulRead;
798 }
799 
800 void CoordSystem::removePointAxis (const QString &identifier)
801 {
802  LOG4CPP_INFO_S ((*mainCat)) << "CoordSystem::removePointAxis identifier=" << identifier.toLatin1 ().data ();
803 
804  m_curveAxes->removePoint (identifier);
805 }
806 
807 void CoordSystem::removePointGraph (const QString &identifier)
808 {
809  LOG4CPP_INFO_S ((*mainCat)) << "CoordSystem::removePointGraph identifier=" << identifier.toLatin1 ().data ();
810 
811  m_curvesGraphs.removePoint (identifier);
812 }
813 
815 {
817 
818  Functor2wRet<const QString &, const Point &, CallbackSearchReturn> ftorWithCallback = functor_ret (ftor,
820 
821  curvesGraphs.iterateThroughCurvesPoints (ftorWithCallback);
822 }
823 
824 void CoordSystem::resetSelectedCurveNameIfNecessary ()
825 {
826  if (m_selectedCurveName.isEmpty () ||
827  curveForCurveName (m_selectedCurveName) == 0) {
828 
829  // Selected curve name is empty, or the curve has been removed so we pick another. The first is arbitrarily picked
830  m_selectedCurveName = m_curvesGraphs.curvesGraphsNames().first();
831  }
832 
833 }
834 
835 void CoordSystem::saveXml (QXmlStreamWriter &writer) const
836 {
837  writer.writeStartElement(DOCUMENT_SERIALIZE_COORD_SYSTEM);
838 
839  // Serialize the Document variables
840  m_modelGeneral.saveXml (writer);
841  m_modelCoords.saveXml (writer);
842  m_modelDigitizeCurve.saveXml (writer);
843  m_modelExport.saveXml (writer);
844  m_modelAxesChecker.saveXml (writer);
845  m_modelGridDisplay.saveXml (writer);
846  m_modelGridRemoval.saveXml (writer);
847  m_modelPointMatch.saveXml (writer);
848  m_modelSegments.saveXml (writer);
849  m_curveAxes->saveXml (writer);
850  m_curvesGraphs.saveXml (writer);
851  writer.writeEndElement();
852 }
853 
855 {
856  return m_selectedCurveName;
857 }
858 
859 void CoordSystem::setCurveAxes (const Curve &curveAxes)
860 {
861  LOG4CPP_INFO_S ((*mainCat)) << "CoordSystem::setCurveAxes";
862 
863  if (m_curveAxes != 0) {
864  delete m_curveAxes;
865  m_curveAxes = 0;
866  }
867 
868  m_curveAxes = new Curve (curveAxes);
869 }
870 
871 void CoordSystem::setCurvesGraphs (const CurvesGraphs &curvesGraphs)
872 {
873  LOG4CPP_INFO_S ((*mainCat)) << "CoordSystem::setCurvesGraphs";
874 
875  m_curvesGraphs = curvesGraphs;
876 
877  resetSelectedCurveNameIfNecessary ();
878 }
879 
881 {
882  m_modelAxesChecker = modelAxesChecker;
883 }
884 
886 {
887  // Save the CurveFilter for each Curve
888  ColorFilterSettingsList::const_iterator itr;
889  for (itr = modelColorFilter.colorFilterSettingsList().constBegin ();
890  itr != modelColorFilter.colorFilterSettingsList().constEnd();
891  itr++) {
892 
893  QString curveName = itr.key();
894  const ColorFilterSettings &colorFilterSettings = itr.value();
895 
896  Curve *curve = curveForCurveName (curveName);
897  curve->setColorFilterSettings (colorFilterSettings);
898  }
899 }
900 
902 {
903  m_modelCoords = modelCoords;
904 }
905 
906 void CoordSystem::setModelCurveStyles(const CurveStyles &modelCurveStyles)
907 {
908  // Save the LineStyle and PointStyle for each Curve
909  QStringList curveNames = modelCurveStyles.curveNames();
910  QStringList::iterator itr;
911  for (itr = curveNames.begin(); itr != curveNames.end(); itr++) {
912 
913  QString curveName = *itr;
914  const CurveStyle &curveStyle = modelCurveStyles.curveStyle (curveName);
915 
916  Curve *curve = curveForCurveName (curveName);
917  curve->setCurveStyle (curveStyle);
918  }
919 }
920 
922 {
923  m_modelDigitizeCurve = modelDigitizeCurve;
924 }
925 
927 {
928  m_modelExport = modelExport;
929 }
930 
932 {
933  m_modelGeneral = modelGeneral;
934 }
935 
937 {
938  m_modelGridDisplay = modelGridDisplay;
939 }
940 
942 {
943  m_modelGridRemoval = modelGridRemoval;
944 }
945 
947 {
948  m_modelPointMatch = modelPointMatch;
949 }
950 
952 {
953  m_modelSegments = modelSegments;
954 }
955 
956 void CoordSystem::setSelectedCurveName(const QString &selectedCurveName)
957 {
958  m_selectedCurveName = selectedCurveName;
959 }
960 
962 {
963  return m_successfulRead;
964 }
965 
967 {
968  LOG4CPP_INFO_S ((*mainCat)) << "CoordSystem::updatePointOrdinals";
969 
970  // The graph coordinates of all points in m_curvesGraphs must have already been updated at this point. See applyTransformation
971  m_curvesGraphs.updatePointOrdinals (transformation);
972 }
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:510
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:473
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:563
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:133
void setPointsSelectionRelations(ExportPointsSelectionRelations exportPointsSelectionRelations)
Set method for point selection for relations.
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:546
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:432
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.
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:153
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:284
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:456
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...
virtual DocumentAxesPointsRequired documentAxesPointsRequired() const
Number of axes points for map or graph. This value is returned after opening a file.
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:490
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 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.
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:423
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.
int numberOfCurvesForImport() const
Return the number of curve names to be generated. Value is maximum of 1 and the number in the configu...
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).
void setPointsIntervalUnitsFunctions(ExportPointsIntervalUnits pointsIntervalUnitsFunctions)
Set method for points interval units for functions.
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:95
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:301
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 setCurveName(const QString &curveName)
Change the curve name.
Definition: Curve.cpp:551
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:33
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:63
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:73
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.
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:316
Model for DlgSettingsGridRemoval and CmdSettingsGridRemoval. The settings are unstable until the user...
void saveXml(QXmlStreamWriter &writer) const
Serialize curve.
Definition: Curve.cpp:523
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.