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