Engauge Digitizer 2
Loading...
Searching...
No Matches
Document.cpp
Go to the documentation of this file.
1/******************************************************************************************************
2 * (C) 2014 markummitchell@github.com. This file is part of Engauge Digitizer, which is released *
3 * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file *
4 * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. *
5 ******************************************************************************************************/
6
11#include "CallbackNextOrdinal.h"
13#include "Curve.h"
14#include "CurvesGraphs.h"
15#include "CurveStyle.h"
16#include "CurveStyles.h"
17#include "Document.h"
18#include "DocumentSerialize.h"
19#include "EngaugeAssert.h"
20#include "EnumsToQt.h"
21#include "GridInitializer.h"
22#include <iostream>
23#include "Logger.h"
24#include "OrdinalGenerator.h"
25#include "Point.h"
26#include "PointStyle.h"
27#include <QByteArray>
28#include <QDataStream>
29#include <QDebug>
30#include <QDomDocument>
31#include <QFile>
32#include <QImage>
33#include <qmath.h>
34#include <QObject>
35#include <QtToString.h>
36#include <QXmlStreamReader>
37#include <QXmlStreamWriter>
38#include "SettingsForGraph.h"
39#include "Transformation.h"
40#include "Version.h"
41#include "Xml.h"
42
43const int FOUR_BYTES = 4;
45const int VERSION_6 = 6;
46const int VERSION_7 = 7;
47const int VERSION_8 = 8;
48const int VERSION_9 = 9;
49const int VERSION_10 = 10;
50const int VERSION_11 = 11;
51const int VERSION_12 = 12;
52const int VERSION_13 = 13;
53
54Document::Document (const QImage &image) :
55 m_name ("untitled"),
56 m_documentAxesPointsRequired (DOCUMENT_AXES_POINTS_REQUIRED_3)
57{
58 LOG4CPP_INFO_S ((*mainCat)) << "Document::Document"
59 << " image=" << image.width() << "x" << image.height();
60
61 m_coordSystemContext.addCoordSystems(NOMINAL_COORD_SYSTEM_COUNT);
62
63 m_successfulRead = true; // Reading from QImage always succeeds, resulting in empty Document
64
65 m_pixmap.convertFromImage (image);
66}
67
69 m_name (fileName),
70 m_documentAxesPointsRequired (DOCUMENT_AXES_POINTS_REQUIRED_3)
71{
72 LOG4CPP_INFO_S ((*mainCat)) << "Document::Document"
73 << " fileName=" << fileName.toLatin1().data();
74
75 m_successfulRead = true;
76
77 // Grab first few bytes to determine the version number
79 if (fileVersion.open(QIODevice::ReadOnly)) {
80
82 fileVersion.close ();
83
84 if (bytesIndicatePreVersion6 (bytesStart)) {
85
86 QFile *file = new QFile (fileName);
87 if (file->open (QIODevice::ReadOnly)) {
89
90 m_coordSystemContext.addCoordSystems(NOMINAL_COORD_SYSTEM_COUNT);
91 loadPreVersion6 (str);
92
93 } else {
94
95 m_successfulRead = false;
96 m_reasonForUnsuccessfulRead = QObject::tr ("Operating system says file is not readable");
97
98 }
99 } else {
100
101 QFile *file = new QFile (fileName);
102 if (file->open (QIODevice::ReadOnly | QIODevice::Text)) {
103
104 int version = versionFromFile (file);
105 switch (version)
106 {
107 case VERSION_6:
108 loadVersion6 (file);
109 break;
110
111 case VERSION_7:
112 case VERSION_8:
113 case VERSION_9:
114 case VERSION_10:
115 case VERSION_11:
116 case VERSION_12:
117 case VERSION_13:
118 loadVersions7AndUp (file);
119 break;
120
121 default:
122 LOG4CPP_ERROR_S ((*mainCat)) << "Document::Document invalid version " << version;
123 m_successfulRead = false;
124 m_reasonForUnsuccessfulRead = QString ("Engauge %1 %2 %3 %4 Engauge")
125 .arg (VERSION_NUMBER)
126 .arg (QObject::tr ("cannot read newer files from version"))
127 .arg (version)
128 .arg (QObject::tr ("of"));
129 break;
130 }
131
132 // Close and deactivate
133 file->close ();
134 delete file;
135 file = nullptr;
136
137 } else {
138
139 m_successfulRead = false;
140 m_reasonForUnsuccessfulRead = QObject::tr ("Operating system says file is not readable");
141 }
142 }
143 } else {
144 fileVersion.close ();
145 m_successfulRead = false;
146 m_reasonForUnsuccessfulRead = QString ("%1 '%2' %3")
147 .arg (QObject::tr ("File"))
148 .arg (fileName)
149 .arg (QObject::tr ("was not found"));
150 }
151}
152
154{
155 LOG4CPP_INFO_S ((*mainCat)) << "Document::addCoordSystems"
156 << " toAdd=" << numberCoordSystemToAdd;
157
158 m_coordSystemContext.addCoordSystems(numberCoordSystemToAdd);
159}
160
162{
163 LOG4CPP_INFO_S ((*mainCat)) << "Document::addGraphCurveAtEnd";
164
165 m_coordSystemContext.addGraphCurveAtEnd (curveName);
166}
167
169 const QPointF &posGraph,
170 QString &identifier,
171 double ordinal,
172 bool isXOnly)
173{
174 LOG4CPP_INFO_S ((*mainCat)) << "Document::addPointAxisWithGeneratedIdentifier";
175
176 m_coordSystemContext.addPointAxisWithGeneratedIdentifier(posScreen,
177 posGraph,
178 identifier,
179 ordinal,
180 isXOnly);
181}
182
184 const QPointF &posGraph,
185 const QString &identifier,
186 double ordinal,
187 bool isXOnly)
188{
189 LOG4CPP_INFO_S ((*mainCat)) << "Document::addPointAxisWithSpecifiedIdentifier";
190
191 m_coordSystemContext.addPointAxisWithSpecifiedIdentifier(posScreen,
192 posGraph,
193 identifier,
194 ordinal,
195 isXOnly);
196}
197
199 const QPointF &posScreen,
200 QString &identifier,
201 double ordinal)
202{
203 LOG4CPP_INFO_S ((*mainCat)) << "Document::addPointGraphWithGeneratedIdentifier";
204
205 m_coordSystemContext.addPointGraphWithGeneratedIdentifier(curveName,
206 posScreen,
207 identifier,
208 ordinal);
209}
210
212 const QPointF &posScreen,
213 const QString &identifier,
214 double ordinal)
215{
216 LOG4CPP_INFO_S ((*mainCat)) << "Document::addPointGraphWithSpecifiedIdentifier";
217
218 m_coordSystemContext.addPointGraphWithSpecifiedIdentifier(curveName,
219 posScreen,
220 identifier,
221 ordinal);
222}
223
225{
226 LOG4CPP_INFO_S ((*mainCat)) << "Document::addPointsInCurvesGraphs";
227
228 m_coordSystemContext.addPointsInCurvesGraphs(curvesGraphs);
229}
230
232 const QPointF &posScreen1,
233 double scaleLength,
236 double ordinal0,
237 double ordinal1)
238{
239 LOG4CPP_INFO_S ((*mainCat)) << "Document::addScaleWithGeneratedIdentifier";
240
241 const bool IS_X_ONLY = false;
242
244 QPointF (0, 0),
246 ordinal0,
247 IS_X_ONLY);
249 QPointF (scaleLength, 0),
251 ordinal1,
252 IS_X_ONLY);
253}
254
255bool Document::bytesIndicatePreVersion6 (const QByteArray &bytes) const
256{
257 LOG4CPP_INFO_S ((*mainCat)) << "Document::bytesIndicatePreVersion6";
258
261
262 // Windows compiler gives warning if 0x## is used instead of '\x##' below
263 preVersion6MagicNumber[0] = '\x00';
264 preVersion6MagicNumber[1] = '\x00';
265 preVersion6MagicNumber[2] = '\xCA';
266 preVersion6MagicNumber[3] = '\xFE';
267
268 return (bytes == preVersion6MagicNumber);
269}
270
272 const QPointF &posGraph,
273 bool &isError,
274 QString &errorMessage,
275 bool isXOnly)
276{
277 LOG4CPP_INFO_S ((*mainCat)) << "Document::checkAddPointAxis";
278
279 m_coordSystemContext.checkAddPointAxis(posScreen,
280 posGraph,
281 isError,
282 errorMessage,
283 isXOnly,
284 m_documentAxesPointsRequired);
285}
286
288 const QPointF &posScreen,
289 const QPointF &posGraph,
290 bool &isError,
291 QString &errorMessage)
292{
293 LOG4CPP_INFO_S ((*mainCat)) << "Document::checkEditPointAxis";
294
295 m_coordSystemContext.checkEditPointAxis(pointIdentifier,
296 posScreen,
297 posGraph,
298 isError,
299 errorMessage,
300 m_documentAxesPointsRequired);
301}
302
304{
305 LOG4CPP_INFO_S ((*mainCat)) << "Document::coordSystem";
306
307 return m_coordSystemContext.coordSystem();
308}
309
310unsigned int Document::coordSystemCount () const
311{
312 LOG4CPP_INFO_S ((*mainCat)) << "Document::coordSystemCount";
313
314 return m_coordSystemContext.coordSystemCount();
315}
316
318{
319 LOG4CPP_INFO_S ((*mainCat)) << "Document::coordSystemIndex";
320
321 return m_coordSystemContext.coordSystemIndex();
322}
323
325{
326 LOG4CPP_INFO_S ((*mainCat)) << "Document::curveAxes";
327
328 return m_coordSystemContext.curveAxes();
329}
330
331Curve *Document::curveForCurveName (const QString &curveName)
332{
333 LOG4CPP_INFO_S ((*mainCat)) << "Document::curveForCurveName";
334
335 return m_coordSystemContext.curveForCurveName(curveName);
336}
337
338const Curve *Document::curveForCurveName (const QString &curveName) const
339{
340 LOG4CPP_INFO_S ((*mainCat)) << "Document::curveForCurveName";
341
342 return m_coordSystemContext.curveForCurveName (curveName);
343}
344
346{
347 LOG4CPP_INFO_S ((*mainCat)) << "Document::curvesGraphs";
348
349 return m_coordSystemContext.curvesGraphs();
350}
351
353{
354 LOG4CPP_INFO_S ((*mainCat)) << "Document::curvesGraphsNames";
355
356 return m_coordSystemContext.curvesGraphsNames();
357}
358
359int Document::curvesGraphsNumPoints(const QString &curveName) const
360{
361 LOG4CPP_INFO_S ((*mainCat)) << "Document::curvesGraphsNumPoints";
362
363 return m_coordSystemContext.curvesGraphsNumPoints(curveName);
364}
365
367{
368 return m_documentAxesPointsRequired;
369}
370
371void Document::editPointAxis (const QPointF &posGraph,
372 const QString &identifier)
373{
374 LOG4CPP_INFO_S ((*mainCat)) << "Document::editPointAxis";
375
376 m_coordSystemContext.editPointAxis(posGraph,
377 identifier);
378}
379
381 bool isY,
382 double x,
383 double y,
385 const Transformation &transformation)
386{
387 LOG4CPP_INFO_S ((*mainCat)) << "Document::editPointCurve";
388
389 m_coordSystemContext.editPointGraph (isX,
390 isY,
391 x,
392 y,
394 transformation);
395}
396
397void Document::generateEmptyPixmap(const QXmlStreamAttributes &attributes)
398{
399 LOG4CPP_INFO_S ((*mainCat)) << "Document::generateEmptyPixmap";
400
401 int width = 800, height = 500; // Defaults
402
403 if (attributes.hasAttribute (DOCUMENT_SERIALIZE_IMAGE_WIDTH) &&
405
406 width = attributes.value (DOCUMENT_SERIALIZE_IMAGE_WIDTH).toInt();
408
409 }
410
411 m_pixmap = QPixmap (width, height);
412}
413
415{
416 LOG4CPP_INFO_S ((*mainCat)) << "Document::initializeGridDisplay";
417
418 ENGAUGE_ASSERT (!m_coordSystemContext.modelGridDisplay().stable());
419
420 // Get graph coordinate bounds
421 CallbackBoundingRects ftor (m_documentAxesPointsRequired,
422 transformation);
423
426
428
429 // Initialize. Note that if there are no graph points then these next steps have no effect
430 bool isEmpty;
431 QPointF boundingRectGraphMin = ftor.boundingRectGraphMin (isEmpty);
432 QPointF boundingRectGraphMax = ftor.boundingRectGraphMax (isEmpty);
433 if (!isEmpty) {
434
436
437 DocumentModelGridDisplay modelGridDisplay = gridInitializer.initializeWithWidePolarCoverage (boundingRectGraphMin,
438 boundingRectGraphMax,
439 modelCoords(),
440 transformation,
441 m_pixmap.size ());
442
443 m_coordSystemContext.setModelGridDisplay (modelGridDisplay);
444 }
445}
446
448{
449 return m_coordSystemContext.isXOnly (pointIdentifier);
450}
451
458
465
468{
469 LOG4CPP_INFO_S ((*mainCat)) << "Document::iterateThroughCurveSegments";
470
471 m_coordSystemContext.iterateThroughCurveSegments(curveName,
473}
474
481
488
489void Document::loadImage(QXmlStreamReader &reader)
490{
491 LOG4CPP_INFO_S ((*mainCat)) << "Document::loadImage";
492
493 loadNextFromReader(reader); // Read to CDATA
494 if (reader.isCDATA ()) {
495
496 // Get base64 array
497 QByteArray array64 = reader.text().toString().toUtf8();
498
499 // Decoded array
501 array = QByteArray::fromBase64(array64);
502
503 // Read decoded array into image
504 QDataStream str (&array, QIODevice::ReadOnly);
505 QImage img = m_pixmap.toImage ();
506 str >> img;
507 m_pixmap = QPixmap::fromImage (img);
508
509 // Read until end of this subtree
510 while ((reader.tokenType() != QXmlStreamReader::EndElement) ||
511 (reader.name() != DOCUMENT_SERIALIZE_IMAGE)){
513 }
514
515 } else {
516
517 // This point can be reached if:
518 // 1) File is broken
519 // 2) Bad character is in text, and NetworkClient::cleanXml did not do its job
520 reader.raiseError (QObject::tr ("Cannot read image data"));
521 }
522}
523
524void Document::loadPreVersion6 (QDataStream &str)
525{
526 LOG4CPP_INFO_S ((*mainCat)) << "Document::loadPreVersion6";
527
529 double version;
530 QString st;
531
532 str >> int32; // Magic number
533 str >> version;
534 str >> st; // Version string
535 str >> int32; // Background
536 str >> m_pixmap;
537 str >> m_name;
538
539 m_coordSystemContext.loadPreVersion6 (str,
540 version,
541 m_documentAxesPointsRequired); // Returns axes points required
542}
543
544void Document::loadVersion6 (QFile *file)
545{
546 LOG4CPP_INFO_S ((*mainCat)) << "Document::loadVersion6";
547
549
550 m_documentAxesPointsRequired = DOCUMENT_AXES_POINTS_REQUIRED_3;
551
552 // Create the single CoordSystem used in versions before version 7
553 m_coordSystemContext.addCoordSystems(NOMINAL_COORD_SYSTEM_COUNT);
554
555 // If this is purely a serialized Document then we process every node under the root. However, if this is an error report file
556 // then we need to skip the non-Document stuff. The common solution is to skip nodes outside the Document subtree using this flag
557 bool inDocumentSubtree = false;
558
559 // Import from xml. Loop to end of data or error condition occurs, whichever is first
560 while (!reader.atEnd() &&
561 !reader.hasError()) {
562 QXmlStreamReader::TokenType tokenType = loadNextFromReader(reader);
563
564 // Special processing of DOCUMENT_SERIALIZE_IMAGE outside DOCUMENT_SERIALIZE_DOCUMENT, for an error report file
565 if ((reader.name() == DOCUMENT_SERIALIZE_IMAGE) &&
566 (tokenType == QXmlStreamReader::StartElement)) {
567
568 generateEmptyPixmap (reader.attributes());
569 }
570
571 // Branching to skip non-Document nodes, with the exception of any DOCUMENT_SERIALIZE_IMAGE outside DOCUMENT_SERIALIZE_DOCUMENT
572 if ((reader.name() == DOCUMENT_SERIALIZE_DOCUMENT) &&
573 (tokenType == QXmlStreamReader::StartElement)) {
574
575 inDocumentSubtree = true;
576
577 } else if ((reader.name() == DOCUMENT_SERIALIZE_DOCUMENT) &&
578 (tokenType == QXmlStreamReader::EndElement)) {
579
580 // Exit out of loop immediately
581 break;
582 }
583
584 if (inDocumentSubtree) {
585
586 // Iterate to next StartElement
587 if (tokenType == QXmlStreamReader::StartElement) {
588
589 // This is a StartElement, so process it up to the corresonding EndElement
590 QString tag = reader.name().toString();
592 // A standard Document file has DOCUMENT_SERIALIZE_IMAGE inside DOCUMENT_SERIALIZE_DOCUMENT, versus an error report file
593 loadImage(reader);
594
595 // Now that we have the image at the DOCUMENT_SERIALIZE_DOCUMENT level, we read the rest at this level into CoordSystem
596 m_coordSystemContext.loadVersion6 (reader,
597 m_documentAxesPointsRequired); // Returns axes points required
598
599 // Reading of DOCUMENT_SERIALIZE_DOCUMENT has just finished, so the reading has finished
600 break;
601 }
602 }
603 }
604 }
605 if (reader.hasError ()) {
606
607 m_successfulRead = false;
608 m_reasonForUnsuccessfulRead = reader.errorString();
609 }
610
611 // There are already one axes curve and at least one graph curve so we do not need to add any more graph curves
612}
613
614void Document::loadVersions7AndUp (QFile *file)
615{
616 LOG4CPP_INFO_S ((*mainCat)) << "Document::loadVersions7AndUp";
617
618 const int ONE_COORDINATE_SYSTEM = 1;
619
621
622 // If this is purely a serialized Document then we process every node under the root. However, if this is an error report file
623 // then we need to skip the non-Document stuff. The common solution is to skip nodes outside the Document subtree using this flag
624 bool inDocumentSubtree = false;
625
626 // Import from xml. Loop to end of data or error condition occurs, whichever is first
627 while (!reader.atEnd() &&
628 !reader.hasError()) {
629 QXmlStreamReader::TokenType tokenType = loadNextFromReader(reader);
630
631 // Special processing of DOCUMENT_SERIALIZE_IMAGE outside DOCUMENT_SERIALIZE_DOCUMENT, for an error report file
632 if ((reader.name() == DOCUMENT_SERIALIZE_IMAGE) &&
633 (tokenType == QXmlStreamReader::StartElement)) {
634
635 generateEmptyPixmap (reader.attributes());
636 }
637
638 // Branching to skip non-Document nodes, with the exception of any DOCUMENT_SERIALIZE_IMAGE outside DOCUMENT_SERIALIZE_DOCUMENT
639 if ((reader.name() == DOCUMENT_SERIALIZE_DOCUMENT) &&
640 (tokenType == QXmlStreamReader::StartElement)) {
641
642 inDocumentSubtree = true;
643
646 m_documentAxesPointsRequired = static_cast<DocumentAxesPointsRequired> (attributes.value (DOCUMENT_SERIALIZE_AXES_POINTS_REQUIRED).toInt());
647 } else {
648 m_documentAxesPointsRequired = DOCUMENT_AXES_POINTS_REQUIRED_3;
649 }
650
651 } else if ((reader.name() == DOCUMENT_SERIALIZE_DOCUMENT) &&
652 (tokenType == QXmlStreamReader::EndElement)) {
653
654 // Exit out of loop immediately
655 break;
656 }
657
658 if (inDocumentSubtree) {
659
660 // Iterate to next StartElement
661 if (tokenType == QXmlStreamReader::StartElement) {
662
663 // This is a StartElement, so process it
664 QString tag = reader.name().toString();
666 m_coordSystemContext.addCoordSystems (ONE_COORDINATE_SYSTEM);
667 m_coordSystemContext.loadVersions7AndUp (reader);
668 } else if (tag == DOCUMENT_SERIALIZE_IMAGE) {
669 // A standard Document file has DOCUMENT_SERIALIZE_IMAGE inside DOCUMENT_SERIALIZE_DOCUMENT, versus an error report file
670 loadImage(reader);
671 }
672 }
673 }
674 }
675 if (reader.hasError ()) {
676
677 m_successfulRead = false;
678 m_reasonForUnsuccessfulRead = reader.errorString();
679 }
680
681 // There are already one axes curve and at least one graph curve so we do not need to add any more graph curves
682}
683
685{
686 LOG4CPP_DEBUG_S ((*mainCat)) << "Document::modelAxesChecker";
687
688 return m_coordSystemContext.modelAxesChecker();
689}
690
692{
693 LOG4CPP_DEBUG_S ((*mainCat)) << "Document::modelColorFilter";
694
695 return m_coordSystemContext.modelColorFilter();
696}
697
699{
700 LOG4CPP_DEBUG_S ((*mainCat)) << "Document::modelCoords";
701
702 return m_coordSystemContext.modelCoords();
703}
704
706{
707 LOG4CPP_DEBUG_S ((*mainCat)) << "Document::modelCurveStyles";
708
709 return m_coordSystemContext.modelCurveStyles();
710}
711
713{
714 LOG4CPP_DEBUG_S ((*mainCat)) << "Document::modelDigitizeCurve";
715
716 return m_coordSystemContext.modelDigitizeCurve();
717}
718
720{
721 LOG4CPP_DEBUG_S ((*mainCat)) << "Document::modelExport";
722
723 return m_coordSystemContext.modelExport();
724}
725
727{
728 LOG4CPP_DEBUG_S ((*mainCat)) << "Document::modelGeneral";
729
730 return m_coordSystemContext.modelGeneral();
731}
732
734{
735 LOG4CPP_DEBUG_S ((*mainCat)) << "Document::modelGridDisplay";
736
737 return m_coordSystemContext.modelGridDisplay();
738}
739
741{
742 LOG4CPP_DEBUG_S ((*mainCat)) << "Document::modelGridRemoval";
743
744 return m_coordSystemContext.modelGridRemoval();
745}
746
748{
749 LOG4CPP_DEBUG_S ((*mainCat)) << "Document::modelGuidelines";
750
751 return m_coordSystemContext.modelGuidelines();
752}
753
755{
756 LOG4CPP_DEBUG_S ((*mainCat)) << "Document::modelPointMatch";
757
758 return m_coordSystemContext.modelPointMatch();
759}
760
762{
763 LOG4CPP_DEBUG_S ((*mainCat)) << "Document::modelSegments";
764
765 return m_coordSystemContext.modelSegments();
766}
767
769 const QPointF &deltaScreen)
770{
771 m_coordSystemContext.movePoint (pointIdentifier,
773}
774
775int Document::nextOrdinalForCurve (const QString &curveName) const
776{
777 LOG4CPP_INFO_S ((*mainCat)) << "Document::nextOrdinalForCurve";
778
779 return m_coordSystemContext.nextOrdinalForCurve(curveName);
780}
781
782void Document::overrideGraphDefaultsWithMapDefaults ()
783{
784 const int DEFAULT_WIDTH = 1;
785
786 // Axis style for scale bar is better with transparent-filled circles so user can more accurately place them,
787 // and a visible line between the points also helps to make the points more visible
789
790 CurveStyle curveStyle = curveStyles.curveStyle (AXIS_CURVE_NAME);
791
792 PointStyle pointStyle = curveStyle.pointStyle ();
793 pointStyle.setShape (POINT_SHAPE_CIRCLE);
795
796 LineStyle lineStyle = curveStyle.lineStyle ();
798 lineStyle.setWidth (DEFAULT_WIDTH);
800
801 curveStyle.setPointStyle (pointStyle);
802 curveStyle.setLineStyle (lineStyle);
803
804 curveStyles.setCurveStyle (AXIS_CURVE_NAME,
805 curveStyle);
806
807 // Change all graph curves from functions to relations
808 QStringList curveNames = curvesGraphsNames ();
809 QStringList::const_iterator itr;
810 for (itr = curveNames.begin(); itr != curveNames.end(); itr++) {
811 QString curveName = *itr;
812 CurveStyle curveStyle = curveStyles.curveStyle (curveName);
813
814 LineStyle lineStyle = curveStyle.lineStyle ();
816
817 curveStyle.setLineStyle (lineStyle);
818
819 curveStyles.setCurveStyle (curveName,
820 curveStyle);
821 }
822
823 // Save modified curve styles into Document
825}
826
828{
829 return m_pixmap;
830}
831
833{
834 return m_coordSystemContext.positionGraph(pointIdentifier);
835}
836
838{
839 return m_coordSystemContext.positionScreen(pointIdentifier);
840}
841
842void Document::print () const
843{
846
847 printStream ("",
848 str);
849 std::cerr << text.toLatin1().data();
850}
851
853 QTextStream &str) const
854{
855 str << indentation << "Document\n";
856
858
859 str << indentation << "name=" << m_name << "\n";
860 str << indentation << "pixmap=" << m_pixmap.width() << "x" << m_pixmap.height() << "\n";
861
862 m_coordSystemContext.printStream(indentation,
863 str);
864}
865
867{
868 ENGAUGE_ASSERT (!m_successfulRead);
869
870 return m_reasonForUnsuccessfulRead;
871}
872
873void Document::removePointAxis (const QString &identifier)
874{
875 LOG4CPP_INFO_S ((*mainCat)) << "Document::removePointAxis";
876
877 m_coordSystemContext.removePointAxis(identifier);
878}
879
880void Document::removePointGraph (const QString &identifier)
881{
882 LOG4CPP_INFO_S ((*mainCat)) << "Document::removePointGraph";
883
884 m_coordSystemContext.removePointGraph(identifier);
885}
886
888{
889 LOG4CPP_INFO_S ((*mainCat)) << "Document::removePointsInCurvesGraphs";
890
891 m_coordSystemContext.removePointsInCurvesGraphs(curvesGraphs);
892}
893
895{
896 writer.writeStartElement(DOCUMENT_SERIALIZE_DOCUMENT);
897
898 // Version number is tacked onto DOCUMENT_SERIALIZE_DOCUMENT since the alternative (creating a new start element)
899 // causes the code to complain during loading
901
902 // Number of axes points required
903 writer.writeAttribute(DOCUMENT_SERIALIZE_AXES_POINTS_REQUIRED, QString::number (m_documentAxesPointsRequired));
904
905 // Serialize the Document image. That binary data is encoded as base64
907 QDataStream str (&array, QIODevice::WriteOnly);
908 QImage img = m_pixmap.toImage ();
909 str << img;
910 writer.writeStartElement(DOCUMENT_SERIALIZE_IMAGE);
911
912 // Image width and height are explicitly inserted for error reports, since the CDATA is removed
913 // but we still want the image size for reconstructing the error(s)
914 writer.writeAttribute(DOCUMENT_SERIALIZE_IMAGE_WIDTH, QString::number (img.width()));
915 writer.writeAttribute(DOCUMENT_SERIALIZE_IMAGE_HEIGHT, QString::number (img.height()));
916
917 writer.writeCDATA (array.toBase64 ());
918 writer.writeEndElement();
919
920 m_coordSystemContext.saveXml (writer);
921}
922
924{
925 return m_coordSystemContext.selectedCurveName();
926}
927
929{
930 LOG4CPP_INFO_S ((*mainCat)) << "Document::setCoordSystemIndex";
931
932 m_coordSystemContext.setCoordSystemIndex (coordSystemIndex);
933}
934
935void Document::setCurveAxes (const Curve &curveAxes)
936{
937 LOG4CPP_INFO_S ((*mainCat)) << "Document::setCurveAxes";
938
939 m_coordSystemContext.setCurveAxes (curveAxes);
940}
941
942void Document::setCurvesGraphs (const CurvesGraphs &curvesGraphs)
943{
944 LOG4CPP_INFO_S ((*mainCat)) << "Document::setCurvesGraphs";
945
946 m_coordSystemContext.setCurvesGraphs(curvesGraphs);
947}
948
950{
951 LOG4CPP_INFO_S ((*mainCat)) << "Document::setDocumentAxesPointsRequired";
952
953 m_documentAxesPointsRequired = documentAxesPointsRequired;
954
956
957 overrideGraphDefaultsWithMapDefaults ();
958 }
959}
960
962{
963 LOG4CPP_INFO_S ((*mainCat)) << "Document::setModelAxesChecker";
964
965 m_coordSystemContext.setModelAxesChecker(modelAxesChecker);
966}
967
969{
970 LOG4CPP_INFO_S ((*mainCat)) << "Document::setModelColorFilter";
971
972 // Save the CurveFilter for each Curve
973 ColorFilterSettingsList::const_iterator itr;
974 for (itr = modelColorFilter.colorFilterSettingsList().constBegin ();
976 itr++) {
977
978 QString curveName = itr.key();
979 const ColorFilterSettings &colorFilterSettings = itr.value();
980
981 Curve *curve = curveForCurveName (curveName);
982 curve->setColorFilterSettings (colorFilterSettings);
983 }
984}
985
987{
988 LOG4CPP_INFO_S ((*mainCat)) << "Document::setModelCoords";
989
990 m_coordSystemContext.setModelCoords(modelCoords);
991}
992
993void Document::setModelCurveStyles(const CurveStyles &modelCurveStyles)
994{
995 LOG4CPP_INFO_S ((*mainCat)) << "Document::setModelCurveStyles";
996
997 // Save the LineStyle and PointStyle for each Curve
999 QStringList::iterator itr;
1000 for (itr = curveNames.begin(); itr != curveNames.end(); itr++) {
1001
1002 QString curveName = *itr;
1003 const CurveStyle &curveStyle = modelCurveStyles.curveStyle (curveName);
1004
1005 Curve *curve = curveForCurveName (curveName);
1006 curve->setCurveStyle (curveStyle);
1007 }
1008}
1009
1011{
1012 LOG4CPP_INFO_S ((*mainCat)) << "Document::setModelDigitizeCurve";
1013
1014 m_coordSystemContext.setModelDigitizeCurve(modelDigitizeCurve);
1015}
1016
1018{
1019 LOG4CPP_INFO_S ((*mainCat)) << "Document::setModelExport";
1020
1021 m_coordSystemContext.setModelExport (modelExport);
1022}
1023
1025{
1026 LOG4CPP_INFO_S ((*mainCat)) << "Document::setModelGeneral";
1027
1028 m_coordSystemContext.setModelGeneral(modelGeneral);
1029}
1030
1032{
1033 LOG4CPP_INFO_S ((*mainCat)) << "Document::setModelGridDisplay";
1034
1035 m_coordSystemContext.setModelGridDisplay(modelGridDisplay);
1036}
1037
1039{
1040 LOG4CPP_INFO_S ((*mainCat)) << "Document::setModelGridRemoval";
1041
1042 m_coordSystemContext.setModelGridRemoval(modelGridRemoval);
1043}
1044
1046{
1047 LOG4CPP_INFO_S ((*mainCat)) << "Document::setModelGuidelines";
1048
1049 m_coordSystemContext.setModelGuidelines(modelGuidelines);
1050}
1051
1053{
1054 LOG4CPP_INFO_S ((*mainCat)) << "Document::setModelPointMatch";
1055
1056 m_coordSystemContext.setModelPointMatch(modelPointMatch);
1057}
1058
1060{
1061 LOG4CPP_INFO_S ((*mainCat)) << "Document::setModelSegments";
1062
1063 m_coordSystemContext.setModelSegments (modelSegments);
1064}
1065
1066void Document::setPixmap(const QImage &image)
1067{
1068 LOG4CPP_INFO_S ((*mainCat)) << "Document::setPixmap";
1069
1070 m_pixmap = QPixmap::fromImage (image);
1071}
1072
1073void Document::setSelectedCurveName(const QString &selectedCurveName)
1074{
1075 m_coordSystemContext.setSelectedCurveName (selectedCurveName);
1076}
1077
1079{
1080 return m_successfulRead;
1081}
1082
1084{
1085 LOG4CPP_INFO_S ((*mainCat)) << "Document::updatePointOrdinals";
1086
1087 m_coordSystemContext.updatePointOrdinals(transformation);
1088}
1089
1090int Document::versionFromFile (QFile *file) const
1091{
1092 LOG4CPP_INFO_S ((*mainCat)) << "Document::versionFromFile";
1093
1094 int version = VERSION_6; // Use default if tag is missing
1095
1097 if (doc.setContent (file)) {
1098
1099 QDomNodeList nodes = doc.elementsByTagName (DOCUMENT_SERIALIZE_DOCUMENT);
1100 if (nodes.count() > 0) {
1101 QDomNode node = nodes.at (0);
1102
1103 QDomNamedNodeMap attributes = node.attributes();
1104
1106
1107 QDomElement elem = node.toElement();
1109 }
1110 }
1111 }
1112
1113 file->seek (0); // Go back to beginning
1114
1115 return version;
1116}
const QString AXIS_CURVE_NAME
@ COLOR_PALETTE_RED
unsigned int CoordSystemIndex
Zero-based index for identifying CoordSystem instantiations.
const int FOUR_BYTES
@ CONNECT_AS_RELATION_STRAIGHT
const int INNER_RADIUS_MIN
@ DOCUMENT_AXES_POINTS_REQUIRED_3
@ DOCUMENT_AXES_POINTS_REQUIRED_2
const QString DOCUMENT_SERIALIZE_COORD_SYSTEM
const QString DOCUMENT_SERIALIZE_AXES_POINTS_REQUIRED
const QString DOCUMENT_SERIALIZE_IMAGE
const QString DOCUMENT_SERIALIZE_IMAGE_HEIGHT
const QString DOCUMENT_SERIALIZE_IMAGE_WIDTH
const QString DOCUMENT_SERIALIZE_DOCUMENT
const QString DOCUMENT_SERIALIZE_APPLICATION_VERSION_NUMBER
const int VERSION_11
Definition Document.cpp:50
const int FOUR_BYTES
Definition Document.cpp:43
const int VERSION_6
Definition Document.cpp:45
const int VERSION_13
Definition Document.cpp:52
const int VERSION_9
Definition Document.cpp:48
const int NOMINAL_COORD_SYSTEM_COUNT
Definition Document.cpp:44
const int VERSION_8
Definition Document.cpp:47
const int VERSION_7
Definition Document.cpp:46
const int VERSION_12
Definition Document.cpp:51
const int VERSION_10
Definition Document.cpp:49
#define ENGAUGE_ASSERT(cond)
Drop in replacement for Q_ASSERT.
log4cpp::Category * mainCat
Definition Logger.cpp:14
const QString INDENTATION_DELTA
@ POINT_SHAPE_CIRCLE
Definition PointShape.h:13
const char * VERSION_NUMBER
Definition Version.cpp:12
QXmlStreamReader::TokenType loadNextFromReader(QXmlStreamReader &reader)
Load next token from xml reader.
Definition Xml.cpp:14
Callback for computing the bounding rectangles of the screen and graph coordinates of the points in t...
CallbackSearchReturn callback(const QString &curveName, const Point &point)
Callback method.
Color filter parameters for one curve. For a class, this is handled the same as LineStyle and PointSt...
unsigned int coordSystemCount() const
Number of CoordSystem.
virtual void setModelGuidelines(const DocumentModelGuidelines &modelGuidelines)
Set method for DocumentModelGuidelines.
void loadVersions7AndUp(QXmlStreamReader &reader)
Load one CoordSystem from file in version 7 format or newer, into the most recent CoordSystem which w...
virtual void addPointGraphWithSpecifiedIdentifier(const QString &curveName, const QPointF &posScreen, const QString &identifier, double ordinal)
Add a single graph point with the specified point identifier. Note that PointStyle is not applied to ...
virtual DocumentModelColorFilter modelColorFilter() const
Get method for DocumentModelColorFilter.
CoordSystemIndex coordSystemIndex() const
Index of current CoordSystem.
virtual CurveStyles modelCurveStyles() const
Get method for CurveStyles.
virtual void setModelAxesChecker(const DocumentModelAxesChecker &modelAxesChecker)
Set method for DocumentModelAxesChecker.
virtual void iterateThroughCurvePointsAxes(const Functor2wRet< const QString &, const Point &, CallbackSearchReturn > &ftorWithCallback)
See Curve::iterateThroughCurvePoints, for the axes curve.
virtual const CurvesGraphs & curvesGraphs() const
Make all Curves available, read only, for CmdAbstract classes only.
const CoordSystem & coordSystem() const
Current CoordSystem.
virtual void setSelectedCurveName(const QString &selectedCurveName)
Save curve name that is selected for the current coordinate system, for the next time the coordinate ...
virtual void printStream(QString indentation, QTextStream &str) const
Debugging method that supports print method of this class and printStream method of some other class(...
virtual void editPointAxis(const QPointF &posGraph, const QString &identifier)
Edit the graph coordinates of a single axis point. Call this after checkAddPointAxis to guarantee suc...
void setModelPointMatch(const DocumentModelPointMatch &modelPointMatch)
Set method for DocumentModelPointMatch.
virtual void setModelGeneral(const DocumentModelGeneral &modelGeneral)
Set method for DocumentModelGeneral.
virtual const Curve & curveAxes() const
Get method for axis curve.
virtual void addPointsInCurvesGraphs(CurvesGraphs &curvesGraphs)
Add all points identified in the specified CurvesGraphs. See also removePointsInCurvesGraphs.
virtual void setModelCoords(const DocumentModelCoords &modelCoords)
Set method for DocumentModelCoords.
virtual void updatePointOrdinals(const Transformation &transformation)
Update point ordinals after point addition/removal or dragging.
void loadPreVersion6(QDataStream &str, double version, DocumentAxesPointsRequired &documentAxesPointsRequired)
Load from file in pre-version 6 format.
virtual DocumentModelGuidelines modelGuidelines() const
Get method for DocumentModelGuidelines.
virtual void addPointGraphWithGeneratedIdentifier(const QString &curveName, const QPointF &posScreen, QString &generatedIentifier, double ordinal)
Add a single graph point with a generated point identifier.
virtual DocumentModelAxesChecker modelAxesChecker() const
Get method for DocumentModelAxesChecker.
void loadVersion6(QXmlStreamReader &reader, DocumentAxesPointsRequired &documentAxesPointsRequired)
Load from file in version 6 format, into the single CoordSystem.
virtual int curvesGraphsNumPoints(const QString &curveName) const
See CurvesGraphs::curvesGraphsNumPoints.
virtual QPointF positionScreen(const QString &pointIdentifier) const
See Curve::positionScreen.
virtual void checkAddPointAxis(const QPointF &posScreen, const QPointF &posGraph, bool &isError, QString &errorMessage, bool isXOnly, DocumentAxesPointsRequired documentAxesPointsRequired)
Check before calling addPointAxis. Also returns the next available ordinal number (to prevent clashes...
bool isXOnly(const QString &pointIdentifier) const
True/false if y/x value is empty.
virtual void setModelSegments(const DocumentModelSegments &modelSegments)
Set method for DocumentModelSegments.
virtual DocumentModelDigitizeCurve modelDigitizeCurve() const
Get method for DocumentModelDigitizeCurve.
virtual DocumentModelCoords modelCoords() const
Get method for DocumentModelCoords.
virtual Curve * curveForCurveName(const QString &curveName)
See CurvesGraphs::curveForCurveName, although this also works for AXIS_CURVE_NAME.
virtual int nextOrdinalForCurve(const QString &curveName) const
Default next ordinal value for specified curve.
virtual DocumentModelSegments modelSegments() const
Get method for DocumentModelSegments.
virtual DocumentModelExportFormat modelExport() const
Get method for DocumentModelExportFormat.
virtual void addGraphCurveAtEnd(const QString &curveName)
Add new graph curve to the list of existing graph curves.
virtual void movePoint(const QString &pointIdentifier, const QPointF &deltaScreen)
See Curve::movePoint.
virtual void setCurvesGraphs(const CurvesGraphs &curvesGraphs)
Let CmdAbstract classes overwrite CurvesGraphs. Applies to current coordinate system.
virtual void saveXml(QXmlStreamWriter &writer) const
Save graph to xml.
virtual DocumentModelGridDisplay modelGridDisplay() const
Get method for DocumentModelGridDisplay.
virtual void setModelExport(const DocumentModelExportFormat &modelExport)
Set method for DocumentModelExportFormat.
virtual void removePointGraph(const QString &identifier)
Perform the opposite of addPointGraph.
void addCoordSystems(unsigned int numberCoordSystemToAdd)
Add specified number of coordinate systems to the original one created by the constructor.
void setCoordSystemIndex(CoordSystemIndex coordSystemIndex)
Index of current CoordSystem.
virtual void setCurveAxes(const Curve &curveAxes)
Let CmdAbstract classes overwrite axes Curve. Applies to current coordinate system.
virtual DocumentModelGridRemoval modelGridRemoval() const
Get method for DocumentModelGridRemoval.
virtual void addPointAxisWithGeneratedIdentifier(const QPointF &posScreen, const QPointF &posGraph, QString &identifier, double ordinal, bool isXOnly)
Add a single axis point with a generated point identifier.
virtual void editPointGraph(bool isX, bool isY, double x, double y, const QStringList &identifiers, const Transformation &transformation)
Edit the graph coordinates of one or more graph points.
virtual void setModelGridDisplay(const DocumentModelGridDisplay &modelGridDisplay)
Set method for DocumentModelGridDisplay.
virtual DocumentModelPointMatch modelPointMatch() const
Get method for DocumentModelPointMatch.
virtual QStringList curvesGraphsNames() const
See CurvesGraphs::curvesGraphsNames.
virtual void iterateThroughCurveSegments(const QString &curveName, const Functor2wRet< const Point &, const Point &, CallbackSearchReturn > &ftorWithCallback) const
See Curve::iterateThroughCurveSegments, for any axes or graph curve.
virtual void addPointAxisWithSpecifiedIdentifier(const QPointF &posScreen, const QPointF &posGraph, const QString &identifier, double ordinal, bool isXOnly)
Add a single axis point with the specified point identifier.
virtual void removePointsInCurvesGraphs(CurvesGraphs &curvesGraphs)
Remove all points identified in the specified CurvesGraphs. See also addPointsInCurvesGraphs.
virtual void removePointAxis(const QString &identifier)
Perform the opposite of addPointAxis.
virtual void checkEditPointAxis(const QString &pointIdentifier, const QPointF &posScreen, const QPointF &posGraph, bool &isError, QString &errorMessage, DocumentAxesPointsRequired documentAxesPointsRequired)
Check before calling editPointAxis.
virtual QString selectedCurveName() const
Currently selected curve name. This is used to set the selected curve combobox in MainWindow.
virtual void iterateThroughCurvesPointsGraphs(const Functor2wRet< const QString &, const Point &, CallbackSearchReturn > &ftorWithCallback)
See Curve::iterateThroughCurvePoints, for all the graphs curves.
virtual void setModelGridRemoval(const DocumentModelGridRemoval &modelGridRemoval)
Set method for DocumentModelGridRemoval.
virtual DocumentModelGeneral modelGeneral() const
Get method for DocumentModelGeneral.
virtual QPointF positionGraph(const QString &pointIdentifier) const
See Curve::positionGraph.
virtual void setModelDigitizeCurve(const DocumentModelDigitizeCurve &modelDigitizeCurve)
Set method for DocumentModelDigitizeCurve.
Storage of data belonging to one coordinate system.
Definition CoordSystem.h:44
Container for LineStyle and PointStyle for one Curve.
Definition CurveStyle.h:19
LineStyle lineStyle() const
Get method for LineStyle.
void setPointStyle(const PointStyle &pointStyle)
Set method for PointStyle.
PointStyle pointStyle() const
Get method for PointStyle.
void setLineStyle(const LineStyle &lineStyle)
Set method for LineStyle.
Model for DlgSettingsCurveProperties and CmdSettingsCurveProperties.
Definition CurveStyles.h:23
CurveStyle curveStyle(const QString &curveName) const
CurveStyle in specified curve.
QStringList curveNames() const
List of all curve names.
Container for one set of digitized Points.
Definition Curve.h:34
Container for all graph curves. The axes point curve is external to this class.
Model for DlgSettingsAxesChecker and CmdSettingsAxesChecker.
Model for DlgSettingsColorFilter and CmdSettingsColorFilter.
const ColorFilterSettingsList & colorFilterSettingsList() const
Get method for copying all color filters in one step.
Model for DlgSettingsCoords and CmdSettingsCoords.
Model for DlgSettingsDigitizeCurve and CmdSettingsDigitizeCurve.
Model for DlgSettingsExportFormat and CmdSettingsExportFormat.
Model for DlgSettingsGeneral and CmdSettingsGeneral.
Model for DlgSettingsGridDisplay and CmdSettingsGridDisplay.
bool stable() const
Get method for stable flag.
Model for DlgSettingsGridRemoval and CmdSettingsGridRemoval. The settings are unstable until the user...
Model for managing the coordinate values corresponding Guidelines.
Model for DlgSettingsPointMatch and CmdSettingsPointMatch.
Model for DlgSettingsSegments and CmdSettingsSegments.
QPointF positionScreen(const QString &pointIdentifier) const
See Curve::positionScreen.
Definition Document.cpp:837
unsigned int coordSystemCount() const
Number of CoordSystem.
Definition Document.cpp:310
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:371
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:466
void setModelGridRemoval(const DocumentModelGridRemoval &modelGridRemoval)
Set method for DocumentModelGridRemoval.
void setCoordSystemIndex(CoordSystemIndex coordSystemIndex)
Set the index of current active CoordSystem.
Definition Document.cpp:928
void iterateThroughCurvePointsAxes(const Functor2wRet< const QString &, const Point &, CallbackSearchReturn > &ftorWithCallback)
See Curve::iterateThroughCurvePoints, for the axes curve.
Definition Document.cpp:452
void setModelGuidelines(const DocumentModelGuidelines &modelGuidelines)
Set method for DocumentModelGuidelines.
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:852
void updatePointOrdinals(const Transformation &transformation)
Update point ordinals after point addition/removal or dragging.
QPixmap pixmap() const
Return the image that is being digitized.
Definition Document.cpp:827
void setDocumentAxesPointsRequired(DocumentAxesPointsRequired documentAxesPointsRequired)
Set the number of axes points required.
Definition Document.cpp:949
DocumentModelGeneral modelGeneral() const
Get method for DocumentModelGeneral.
Definition Document.cpp:726
void addPointAxisWithGeneratedIdentifier(const QPointF &posScreen, const QPointF &posGraph, QString &identifier, double ordinal, bool isXOnly)
Add a single axis point with a generated point identifier.
Definition Document.cpp:168
QPointF positionGraph(const QString &pointIdentifier) const
See Curve::positionGraph.
Definition Document.cpp:832
const Curve & curveAxes() const
Get method for axis curve.
Definition Document.cpp:324
CoordSystemIndex coordSystemIndex() const
Index of current active CoordSystem.
Definition Document.cpp:317
QString selectedCurveName() const
Currently selected curve name. This is used to set the selected curve combobox in MainWindow.
Definition Document.cpp:923
void iterateThroughCurvesPointsGraphs(const Functor2wRet< const QString &, const Point &, CallbackSearchReturn > &ftorWithCallback)
See Curve::iterateThroughCurvePoints, for all the graphs curves.
Definition Document.cpp:475
void addPointGraphWithSpecifiedIdentifier(const QString &curveName, const QPointF &posScreen, const QString &identifier, double ordinal)
Add a single graph point with the specified point identifier. Note that PointStyle is not applied to ...
Definition Document.cpp:211
QStringList curvesGraphsNames() const
See CurvesGraphs::curvesGraphsNames.
Definition Document.cpp:352
bool isXOnly(const QString &pointIdentifier) const
See Curve::isXOnly.
Definition Document.cpp:447
void setModelPointMatch(const DocumentModelPointMatch &modelPointMatch)
Set method for DocumentModelPointMatch.
Document(const QImage &image)
Constructor for imported images and dragged images. Only one coordinate system is create - others are...
Definition Document.cpp:54
void removePointGraph(const QString &identifier)
Perform the opposite of addPointGraph.
Definition Document.cpp:880
void setModelCurveStyles(const CurveStyles &modelCurveStyles)
Set method for CurveStyles.
Definition Document.cpp:993
void addPointAxisWithSpecifiedIdentifier(const QPointF &posScreen, const QPointF &posGraph, const QString &identifier, double ordinal, bool isXOnly)
Add a single axis point with the specified point identifier.
Definition Document.cpp:183
const CoordSystem & coordSystem() const
Currently active CoordSystem.
Definition Document.cpp:303
void initializeGridDisplay(const Transformation &transformation)
Initialize grid display. This is called immediately after the transformation has been defined for the...
Definition Document.cpp:414
void setModelGridDisplay(const DocumentModelGridDisplay &modelGridDisplay)
Set method for DocumentModelGridDisplay.
DocumentModelPointMatch modelPointMatch() const
Get method for DocumentModelPointMatch.
Definition Document.cpp:754
DocumentModelDigitizeCurve modelDigitizeCurve() const
Get method for DocumentModelDigitizeCurve.
Definition Document.cpp:712
int nextOrdinalForCurve(const QString &curveName) const
Default next ordinal value for specified curve.
Definition Document.cpp:775
void removePointsInCurvesGraphs(CurvesGraphs &curvesGraphs)
Remove all points identified in the specified CurvesGraphs. See also addPointsInCurvesGraphs.
Definition Document.cpp:887
void print() const
Debugging method for printing directly from symbolic debugger.
Definition Document.cpp:842
bool successfulRead() const
Return true if startup loading succeeded. If the loading failed then reasonForUnsuccessfulRed will ex...
void addCoordSystems(unsigned int numberCoordSystemToAdd)
Add some number (0 or more) of additional coordinate systems.
Definition Document.cpp:153
void addGraphCurveAtEnd(const QString &curveName)
Add new graph curve to the list of existing graph curves.
Definition Document.cpp:161
void setModelColorFilter(const DocumentModelColorFilter &modelColorFilter)
Set method for DocumentModelColorFilter.
Definition Document.cpp:968
void setModelDigitizeCurve(const DocumentModelDigitizeCurve &modelDigitizeCurve)
Set method for DocumentModelDigitizeCurve.
QString reasonForUnsuccessfulRead() const
Return an informative text message explaining why startup loading failed. Applies if successfulRead r...
Definition Document.cpp:866
void saveXml(QXmlStreamWriter &writer) const
Save document to xml.
Definition Document.cpp:894
void addScaleWithGeneratedIdentifier(const QPointF &posScreen0, const QPointF &posScreen1, double scaleLength, QString &identifier0, QString &identifier1, double ordinal0, double ordinal1)
Add scale with a generated point identifier.
Definition Document.cpp:231
DocumentModelAxesChecker modelAxesChecker() const
Get method for DocumentModelAxesChecker.
Definition Document.cpp:684
void editPointGraph(bool isX, bool isY, double x, double y, const QStringList &identifiers, const Transformation &transformation)
Edit the graph coordinates of one or more graph points.
Definition Document.cpp:380
DocumentModelCoords modelCoords() const
Get method for DocumentModelCoords.
Definition Document.cpp:698
DocumentModelColorFilter modelColorFilter() const
Get method for DocumentModelColorFilter.
Definition Document.cpp:691
void checkEditPointAxis(const QString &pointIdentifier, const QPointF &posScreen, const QPointF &posGraph, bool &isError, QString &errorMessage)
Check before calling editPointAxis.
Definition Document.cpp:287
void setCurvesGraphs(const CurvesGraphs &curvesGraphs)
Let CmdAbstract classes overwrite CurvesGraphs.
Definition Document.cpp:942
CurveStyles modelCurveStyles() const
Get method for CurveStyles.
Definition Document.cpp:705
void setModelCoords(const DocumentModelCoords &modelCoords)
Set method for DocumentModelCoords.
Definition Document.cpp:986
void setModelAxesChecker(const DocumentModelAxesChecker &modelAxesChecker)
Set method for DocumentModelAxesChecker.
Definition Document.cpp:961
DocumentAxesPointsRequired documentAxesPointsRequired() const
Get method for DocumentAxesPointsRequired.
Definition Document.cpp:366
void setModelSegments(const DocumentModelSegments &modelSegments)
Set method for DocumentModelSegments.
DocumentModelGuidelines modelGuidelines() const
Get method for DocumentModelGuidelines.
Definition Document.cpp:747
void setCurveAxes(const Curve &curveAxes)
Let CmdAbstract classes overwrite axes Curve.
Definition Document.cpp:935
const CurvesGraphs & curvesGraphs() const
Make all Curves available, read only, for CmdAbstract classes only.
Definition Document.cpp:345
int curvesGraphsNumPoints(const QString &curveName) const
See CurvesGraphs::curvesGraphsNumPoints.
Definition Document.cpp:359
void setModelGeneral(const DocumentModelGeneral &modelGeneral)
Set method for DocumentModelGeneral.
void setModelExport(const DocumentModelExportFormat &modelExport)
Set method for DocumentModelExportFormat.
DocumentModelGridRemoval modelGridRemoval() const
Get method for DocumentModelGridRemoval.
Definition Document.cpp:740
DocumentModelGridDisplay modelGridDisplay() const
Get method for DocumentModelGridDisplay.
Definition Document.cpp:733
DocumentModelExportFormat modelExport() const
Get method for DocumentModelExportFormat.
Definition Document.cpp:719
void setSelectedCurveName(const QString &selectedCurveName)
Save curve name that is selected for the current coordinate system, for the next time the coordinate ...
void movePoint(const QString &pointIdentifier, const QPointF &deltaScreen)
See Curve::movePoint.
Definition Document.cpp:768
const Curve * curveForCurveName(const QString &curveName) const
See CurvesGraphs::curveForCurveNames, although this also works for AXIS_CURVE_NAME.
Definition Document.cpp:338
DocumentModelSegments modelSegments() const
Get method for DocumentModelSegments.
Definition Document.cpp:761
void setPixmap(const QImage &image)
Set method for the background pixmap.
void checkAddPointAxis(const QPointF &posScreen, const QPointF &posGraph, bool &isError, QString &errorMessage, bool isXOnly)
Check before calling addPointAxis. Also returns the next available ordinal number (to prevent clashes...
Definition Document.cpp:271
void removePointAxis(const QString &identifier)
Perform the opposite of addPointAxis.
Definition Document.cpp:873
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:198
void addPointsInCurvesGraphs(CurvesGraphs &curvesGraphs)
Add all points identified in the specified CurvesGraphs. See also removePointsInCurvesGraphs.
Definition Document.cpp:224
This class initializes the count, start, step and stop parameters for one coordinate (either x/theta ...
Details for a specific Line.
Definition LineStyle.h:20
void setCurveConnectAs(CurveConnectAs curveConnectAs)
Set connect as.
void setWidth(int width)
Set width of line.
void setPaletteColor(ColorPalette paletteColor)
Set method for line color.
Details for a specific Point.
Definition PointStyle.h:21
void setPaletteColor(ColorPalette paletteColor)
Set method for point color.
void setShape(PointShape shape)
Set method for point shape.
Affine transformation between screen and graph coordinates, based on digitized axis points.
#define LOG4CPP_INFO_S(logger)
Definition convenience.h:18
#define LOG4CPP_DEBUG_S(logger)
Definition convenience.h:20
#define LOG4CPP_ERROR_S(logger)
Definition convenience.h:12