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