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