7 #include "CallbackAddPointsInCurvesGraphs.h"
8 #include "CallbackBoundingRects.h"
9 #include "CallbackCheckAddPointAxis.h"
10 #include "CallbackCheckEditPointAxis.h"
11 #include "CallbackNextOrdinal.h"
12 #include "CallbackRemovePointsInCurvesGraphs.h"
14 #include "CurvesGraphs.h"
15 #include "CurveStyles.h"
17 #include "DocumentSerialize.h"
18 #include "EngaugeAssert.h"
19 #include "EnumsToQt.h"
20 #include "GridInitializer.h"
23 #include "OrdinalGenerator.h"
26 #include <QDataStream>
28 #include <QDomDocument>
33 #include <QtToString.h>
34 #include <QXmlStreamReader>
35 #include <QXmlStreamWriter>
36 #include "SettingsForGraph.h"
37 #include "Transformation.h"
41 const int FOUR_BYTES = 4;
42 const int NOMINAL_COORD_SYSTEM_COUNT = 1;
43 const int VERSION_6 = 6;
44 const int VERSION_7 = 7;
45 const int VERSION_8 = 8;
46 const int VERSION_9 = 9;
50 m_documentAxesPointsRequired (DOCUMENT_AXES_POINTS_REQUIRED_3)
52 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::Document"
53 <<
" image=" << image.width() <<
"x" << image.height();
56 NOMINAL_COORD_SYSTEM_COUNT);
58 m_successfulRead =
true;
60 m_pixmap.convertFromImage (image);
65 m_documentAxesPointsRequired (DOCUMENT_AXES_POINTS_REQUIRED_3)
67 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::Document"
68 <<
" fileName=" << fileName.toLatin1().data();
70 m_successfulRead =
true;
73 QFile *file =
new QFile (fileName);
74 if (file->open(QIODevice::ReadOnly)) {
76 QByteArray bytesStart = file->read (FOUR_BYTES);
79 if (bytesIndicatePreVersion6 (bytesStart)) {
81 QFile *file =
new QFile (fileName);
82 if (file->open (QIODevice::ReadOnly)) {
83 QDataStream str (file);
86 NOMINAL_COORD_SYSTEM_COUNT);
87 loadPreVersion6 (str);
91 m_successfulRead =
false;
92 m_reasonForUnsuccessfulRead = QObject::tr (
"Operating system says file is not readable");
97 QFile *file =
new QFile (fileName);
98 if (file->open (QIODevice::ReadOnly | QIODevice::Text)) {
100 int version = versionFromFile (file);
110 loadVersions7AndUp (file);
114 m_successfulRead =
false;
115 m_reasonForUnsuccessfulRead = QString (
"Engauge %1 %2 %3 %4 Engauge")
116 .arg (VERSION_NUMBER)
117 .arg (QObject::tr (
"cannot read newer files from version"))
119 .arg (QObject::tr (
"of"));
130 m_successfulRead =
false;
131 m_reasonForUnsuccessfulRead = QObject::tr (
"Operating system says file is not readable");
136 m_successfulRead =
false;
137 m_reasonForUnsuccessfulRead = QString (
"%1 '%2' %3")
138 .arg (QObject::tr (
"File"))
140 .arg (QObject::tr (
"was not found"));
147 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::addCoordSystems"
148 <<
" toAdd=" << numberCoordSystemToAdd;
151 numberCoordSystemToAdd);
156 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::addGraphCurveAtEnd";
162 const QPointF &posGraph,
167 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::addPointAxisWithGeneratedIdentifier";
177 const QPointF &posGraph,
178 const QString &identifier,
182 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::addPointAxisWithSpecifiedIdentifier";
192 const QPointF &posScreen,
196 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::addPointGraphWithGeneratedIdentifier";
205 const QPointF &posScreen,
206 const QString &identifier,
209 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::addPointGraphWithSpecifiedIdentifier";
219 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::addPointsInCurvesGraphs";
224 bool Document::bytesIndicatePreVersion6 (
const QByteArray &bytes)
const
226 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::bytesIndicatePreVersion6";
228 QByteArray preVersion6MagicNumber;
229 preVersion6MagicNumber.resize (FOUR_BYTES);
232 preVersion6MagicNumber[0] =
'\x00';
233 preVersion6MagicNumber[1] =
'\x00';
234 preVersion6MagicNumber[2] =
'\xCA';
235 preVersion6MagicNumber[3] =
'\xFE';
237 return (bytes == preVersion6MagicNumber);
241 const QPointF &posGraph,
243 QString &errorMessage,
246 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::checkAddPointAxis";
256 const QPointF &posScreen,
257 const QPointF &posGraph,
259 QString &errorMessage)
261 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::checkEditPointAxis";
272 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::coordSystem";
279 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::coordSystemCount";
286 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::coordSystemIndex";
293 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::curveAxes";
300 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::curveForCurveName";
307 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::curveForCurveName";
314 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::curvesGraphs";
321 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::curvesGraphsNames";
328 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::curvesGraphsNumPoints";
335 return m_documentAxesPointsRequired;
339 const QString &identifier)
341 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::editPointAxis";
351 const QStringList &identifiers,
354 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::editPointCurve";
364 void Document::generateEmptyPixmap(
const QXmlStreamAttributes &attributes)
366 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::generateEmptyPixmap";
368 int width = 800, height = 500;
370 if (attributes.hasAttribute (DOCUMENT_SERIALIZE_IMAGE_WIDTH) &&
371 attributes.hasAttribute (DOCUMENT_SERIALIZE_IMAGE_HEIGHT)) {
373 width = attributes.value (DOCUMENT_SERIALIZE_IMAGE_WIDTH).toInt();
374 height = attributes.value (DOCUMENT_SERIALIZE_IMAGE_HEIGHT).toInt();
378 m_pixmap = QPixmap (width, height);
383 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::initializeGridDisplay";
390 Functor2wRet<const QString &, const Point &, CallbackSearchReturn> ftorWithCallback = functor_ret (ftor,
397 QRectF boundingRectGraph = ftor.boundingRectGraph(isEmpty);
413 return m_coordSystemContext.
isXOnly (pointIdentifier);
418 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::iterateThroughCurvePointsAxes";
425 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::iterateThroughCurvePointsAxes";
431 const Functor2wRet<const Point &, const Point &, CallbackSearchReturn> &ftorWithCallback)
const
433 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::iterateThroughCurveSegments";
441 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::iterateThroughCurvesPointsGraphs";
448 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::iterateThroughCurvesPointsGraphs";
453 void Document::loadImage(QXmlStreamReader &reader)
455 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::loadImage";
457 loadNextFromReader(reader);
458 if (reader.isCDATA ()) {
461 QByteArray array64 = reader.text().toString().toUtf8();
465 array = QByteArray::fromBase64(array64);
468 QDataStream str (&array, QIODevice::ReadOnly);
469 QImage img = m_pixmap.toImage ();
471 m_pixmap = QPixmap::fromImage (img);
474 while ((reader.tokenType() != QXmlStreamReader::EndElement) ||
475 (reader.name() != DOCUMENT_SERIALIZE_IMAGE)){
476 loadNextFromReader(reader);
484 reader.raiseError (QObject::tr (
"Cannot read image data"));
488 void Document::loadPreVersion6 (QDataStream &str)
490 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::loadPreVersion6";
496 m_documentAxesPointsRequired = DOCUMENT_AXES_POINTS_REQUIRED_3;
509 void Document::loadVersion6 (QFile *file)
511 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::loadVersion6";
513 QXmlStreamReader reader (file);
515 m_documentAxesPointsRequired = DOCUMENT_AXES_POINTS_REQUIRED_3;
519 NOMINAL_COORD_SYSTEM_COUNT);
523 bool inDocumentSubtree =
false;
526 while (!reader.atEnd() &&
527 !reader.hasError()) {
528 QXmlStreamReader::TokenType tokenType = loadNextFromReader(reader);
531 if ((reader.name() == DOCUMENT_SERIALIZE_IMAGE) &&
532 (tokenType == QXmlStreamReader::StartElement)) {
534 generateEmptyPixmap (reader.attributes());
538 if ((reader.name() == DOCUMENT_SERIALIZE_DOCUMENT) &&
539 (tokenType == QXmlStreamReader::StartElement)) {
541 inDocumentSubtree =
true;
543 }
else if ((reader.name() == DOCUMENT_SERIALIZE_DOCUMENT) &&
544 (tokenType == QXmlStreamReader::EndElement)) {
550 if (inDocumentSubtree) {
553 if (tokenType == QXmlStreamReader::StartElement) {
556 QString tag = reader.name().toString();
557 if (tag == DOCUMENT_SERIALIZE_IMAGE) {
570 if (reader.hasError ()) {
572 m_successfulRead =
false;
573 m_reasonForUnsuccessfulRead = reader.errorString();
579 void Document::loadVersions7AndUp (QFile *file)
581 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::loadVersions7AndUp";
583 const int ONE_COORDINATE_SYSTEM = 1;
585 QXmlStreamReader reader (file);
589 bool inDocumentSubtree =
false;
592 while (!reader.atEnd() &&
593 !reader.hasError()) {
594 QXmlStreamReader::TokenType tokenType = loadNextFromReader(reader);
597 if ((reader.name() == DOCUMENT_SERIALIZE_IMAGE) &&
598 (tokenType == QXmlStreamReader::StartElement)) {
600 generateEmptyPixmap (reader.attributes());
604 if ((reader.name() == DOCUMENT_SERIALIZE_DOCUMENT) &&
605 (tokenType == QXmlStreamReader::StartElement)) {
607 inDocumentSubtree =
true;
609 QXmlStreamAttributes attributes = reader.attributes();
610 if (attributes.hasAttribute (DOCUMENT_SERIALIZE_AXES_POINTS_REQUIRED)) {
611 m_documentAxesPointsRequired = (DocumentAxesPointsRequired) attributes.value (DOCUMENT_SERIALIZE_AXES_POINTS_REQUIRED).toInt();
613 m_documentAxesPointsRequired = DOCUMENT_AXES_POINTS_REQUIRED_3;
616 }
else if ((reader.name() == DOCUMENT_SERIALIZE_DOCUMENT) &&
617 (tokenType == QXmlStreamReader::EndElement)) {
623 if (inDocumentSubtree) {
626 if (tokenType == QXmlStreamReader::StartElement) {
629 QString tag = reader.name().toString();
630 if (tag == DOCUMENT_SERIALIZE_COORD_SYSTEM) {
632 ONE_COORDINATE_SYSTEM);
634 m_documentAxesPointsRequired);
635 }
else if (tag == DOCUMENT_SERIALIZE_IMAGE) {
642 if (reader.hasError ()) {
644 m_successfulRead =
false;
645 m_reasonForUnsuccessfulRead = reader.errorString();
653 LOG4CPP_DEBUG_S ((*mainCat)) <<
"Document::modelAxesChecker";
660 LOG4CPP_DEBUG_S ((*mainCat)) <<
"Document::modelColorFilter";
667 LOG4CPP_DEBUG_S ((*mainCat)) <<
"Document::modelCoords";
674 LOG4CPP_DEBUG_S ((*mainCat)) <<
"Document::modelCurveStyles";
681 LOG4CPP_DEBUG_S ((*mainCat)) <<
"Document::modelDigitizeCurve";
688 LOG4CPP_DEBUG_S ((*mainCat)) <<
"Document::modelExport";
695 LOG4CPP_DEBUG_S ((*mainCat)) <<
"Document::modelGeneral";
702 LOG4CPP_DEBUG_S ((*mainCat)) <<
"Document::modelGridDisplay";
709 LOG4CPP_DEBUG_S ((*mainCat)) <<
"Document::modelGridRemoval";
716 LOG4CPP_DEBUG_S ((*mainCat)) <<
"Document::modelPointMatch";
723 LOG4CPP_DEBUG_S ((*mainCat)) <<
"Document::modelSegments";
729 const QPointF &deltaScreen)
731 m_coordSystemContext.
movePoint (pointIdentifier,
737 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::nextOrdinalForCurve";
760 QTextStream str (&text);
764 std::cerr << text.toLatin1().data();
768 QTextStream &str)
const
770 str << indentation <<
"Document\n";
772 indentation += INDENTATION_DELTA;
774 str << indentation <<
"name=" << m_name <<
"\n";
775 str << indentation <<
"pixmap=" << m_pixmap.width() <<
"x" << m_pixmap.height() <<
"\n";
783 ENGAUGE_ASSERT (!m_successfulRead);
785 return m_reasonForUnsuccessfulRead;
790 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::removePointAxis";
797 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::removePointGraph";
804 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::removePointsInCurvesGraphs";
811 writer.writeStartElement(DOCUMENT_SERIALIZE_DOCUMENT);
815 writer.writeAttribute(DOCUMENT_SERIALIZE_APPLICATION_VERSION_NUMBER, VERSION_NUMBER);
818 writer.writeAttribute(DOCUMENT_SERIALIZE_AXES_POINTS_REQUIRED, QString::number (m_documentAxesPointsRequired));
822 QDataStream str (&array, QIODevice::WriteOnly);
823 QImage img = m_pixmap.toImage ();
825 writer.writeStartElement(DOCUMENT_SERIALIZE_IMAGE);
829 writer.writeAttribute(DOCUMENT_SERIALIZE_IMAGE_WIDTH, QString::number (img.width()));
830 writer.writeAttribute(DOCUMENT_SERIALIZE_IMAGE_HEIGHT, QString::number (img.height()));
832 writer.writeCDATA (array.toBase64 ());
833 writer.writeEndElement();
835 m_coordSystemContext.
saveXml (writer);
845 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setCoordSystemIndex";
852 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setCurveAxes";
859 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setCurvesGraphs";
866 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setDocumentAxesPointsRequired";
873 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setModelAxesChecker";
880 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setModelColorFilter";
883 ColorFilterSettingsList::const_iterator itr;
888 QString curveName = itr.key();
898 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setModelCoords";
905 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setModelCurveStyles";
908 QStringList curveNames = modelCurveStyles.
curveNames();
909 QStringList::iterator itr;
910 for (itr = curveNames.begin(); itr != curveNames.end(); itr++) {
912 QString curveName = *itr;
922 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setModelDigitizeCurve";
929 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setModelExport";
936 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setModelGeneral";
943 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setModelGridDisplay";
950 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setModelGridRemoval";
957 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setModelPointMatch";
964 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setModelSegments";
971 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setPixmap";
973 m_pixmap = QPixmap::fromImage (image);
983 return m_successfulRead;
988 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::updatePointOrdinals";
993 int Document::versionFromFile (QFile *file)
const
995 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::versionFromFile";
997 int version = VERSION_6;
1000 if (doc.setContent (file)) {
1002 QDomNodeList nodes = doc.elementsByTagName (DOCUMENT_SERIALIZE_DOCUMENT);
1003 if (nodes.count() > 0) {
1004 QDomNode node = nodes.at (0);
1006 QDomNamedNodeMap attributes = node.attributes();
1008 if (attributes.contains (DOCUMENT_SERIALIZE_APPLICATION_VERSION_NUMBER)) {
1010 QDomElement elem = node.toElement();
1011 version = (int) elem.attribute (DOCUMENT_SERIALIZE_APPLICATION_VERSION_NUMBER).toDouble();
void addCoordSystems(unsigned int numberCoordSystemToAdd)
Add some number (0 or more) of additional coordinate systems.
virtual QString selectedCurveName() const
Currently selected curve name. This is used to set the selected curve combobox in MainWindow...
void addCoordSystems(DocumentAxesPointsRequired documentAxesPointsRequired, unsigned int numberCoordSystemToAdd)
Add specified number of coordinate systems to the original one created by the constructor.
void addGraphCurveAtEnd(const QString &curveName)
Add new graph curve to the list of existing graph curves.
QPointF positionScreen(const QString &pointIdentifier) const
See Curve::positionScreen.
QStringList curveNames() const
List of all curve names.
virtual DocumentModelGeneral modelGeneral() const
Get method for DocumentModelGeneral.
Model for DlgSettingsGeneral and CmdSettingsGeneral.
DocumentAxesPointsRequired documentAxesPointsRequired() const
Get method for DocumentAxesPointsRequired.
CallbackSearchReturn callback(const QString &curveName, const Point &point)
Callback method.
virtual void saveXml(QXmlStreamWriter &writer) const
Save graph to xml.
void movePoint(const QString &pointIdentifier, const QPointF &deltaScreen)
See Curve::movePoint.
void printStream(QString indentation, QTextStream &str) const
Debugging method that supports print method of this class and printStream method of some other class(...
unsigned int coordSystemCount() const
Number of CoordSystem.
Model for DlgSettingsPointMatch and CmdSettingsPointMatch.
Color filter parameters for one curve. For a class, this is handled the same as LineStyle and PointSt...
Model for DlgSettingsGridDisplay and CmdSettingsGridDisplay.
bool isXOnly(const QString &pointIdentifier) const
See Curve::isXOnly.
DocumentModelColorFilter modelColorFilter() const
Get method for DocumentModelColorFilter.
void setModelAxesChecker(const DocumentModelAxesChecker &modelAxesChecker)
Set method for DocumentModelAxesChecker.
void setModelGridRemoval(const DocumentModelGridRemoval &modelGridRemoval)
Set method for DocumentModelGridRemoval.
virtual void addPointGraphWithGeneratedIdentifier(const QString &curveName, const QPointF &posScreen, QString &generatedIentifier, double ordinal)
Add a single graph point with a generated point identifier.
void addPointGraphWithGeneratedIdentifier(const QString &curveName, const QPointF &posScreen, QString &generatedIentifier, double ordinal)
Add a single graph point with a generated point identifier.
DocumentModelPointMatch modelPointMatch() const
Get method for DocumentModelPointMatch.
void setCurveStyle(const CurveStyle &curveStyle)
Set curve style.
void setModelPointMatch(const DocumentModelPointMatch &modelPointMatch)
Set method for DocumentModelPointMatch.
void removePointAxis(const QString &identifier)
Perform the opposite of addPointAxis.
void setModelGeneral(const DocumentModelGeneral &modelGeneral)
Set method for DocumentModelGeneral.
Model for DlgSettingsCurveProperties and CmdSettingsCurveProperties.
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 setModelSegments(const DocumentModelSegments &modelSegments)
Set method for DocumentModelSegments.
const CoordSystem & coordSystem() const
Currently active CoordSystem.
virtual DocumentModelGridRemoval modelGridRemoval() const
Get method for DocumentModelGridRemoval.
void setColorFilterSettings(const ColorFilterSettings &colorFilterSettings)
Set color filter.
virtual void checkEditPointAxis(const QString &pointIdentifier, const QPointF &posScreen, const QPointF &posGraph, bool &isError, QString &errorMessage)
Check before calling editPointAxis.
virtual void addPointGraphWithSpecifiedIdentifier(const QString &curveName, const QPointF &posScreen, const QString &identifier, double ordinal)
Add a single graph point with the specified point identifer. Note that PointStyle is not applied to t...
Storage of data belonging to one coordinate system.
const CoordSystem & coordSystem() const
Current CoordSystem.
void setModelGridDisplay(const DocumentModelGridDisplay &modelGridDisplay)
Set method for DocumentModelGridDisplay.
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...
virtual DocumentModelExportFormat modelExport() const
Get method for DocumentModelExportFormat.
void iterateThroughCurvePointsAxes(const Functor2wRet< const QString &, const Point &, CallbackSearchReturn > &ftorWithCallback)
See Curve::iterateThroughCurvePoints, for the axes curve.
const Curve & curveAxes() const
Get method for axis curve.
DocumentModelCoords modelCoords() const
Get method for DocumentModelCoords.
virtual Curve * curveForCurveName(const QString &curveName)
See CurvesGraphs::curveForCurveName, although this also works for AXIS_CURVE_NAME.
void setModelDigitizeCurve(const DocumentModelDigitizeCurve &modelDigitizeCurve)
Set method for DocumentModelDigitizeCurve.
int curvesGraphsNumPoints(const QString &curveName) const
See CurvesGraphs::curvesGraphsNumPoints.
QPixmap pixmap() const
Return the image that is being digitized.
unsigned int coordSystemCount() const
Number of CoordSystem.
virtual void checkAddPointAxis(const QPointF &posScreen, const QPointF &posGraph, bool &isError, QString &errorMessage, bool isXOnly)
Check before calling addPointAxis. Also returns the next available ordinal number (to prevent clashes...
bool successfulRead() const
Return true if startup loading succeeded. If the loading failed then reasonForUnsuccessfulRed will ex...
CoordSystemIndex coordSystemIndex() const
Index of current CoordSystem.
virtual void removePointsInCurvesGraphs(CurvesGraphs &curvesGraphs)
Remove all points identified in the specified CurvesGraphs. See also addPointsInCurvesGraphs.
void setModelCoords(const DocumentModelCoords &modelCoords)
Set method for DocumentModelCoords.
virtual void setModelCoords(const DocumentModelCoords &modelCoords)
Set method for DocumentModelCoords.
void checkAddPointAxis(const QPointF &posScreen, const QPointF &posGraph, bool &isError, QString &errorMessage, bool isXOnly)
Check before calling addPointAxis. Also returns the next available ordinal number (to prevent clashes...
virtual const Curve & curveAxes() const
Get method for axis curve.
void setPixmap(const QImage &image)
Set method for the background pixmap.
void checkEditPointAxis(const QString &pointIdentifier, const QPointF &posScreen, const QPointF &posGraph, bool &isError, QString &errorMessage)
Check before calling editPointAxis.
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 setModelGridDisplay(const DocumentModelGridDisplay &modelGridDisplay)
Set method for DocumentModelGridDisplay.
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.
void setCoordSystemIndex(CoordSystemIndex coordSystemIndex)
Set the index of current active CoordSystem.
void removePointGraph(const QString &identifier)
Perform the opposite of addPointGraph.
virtual void setCurvesGraphs(const CurvesGraphs &curvesGraphs)
Let CmdAbstract classes overwrite CurvesGraphs. Applies to current coordinate system.
virtual CurveStyles modelCurveStyles() const
Get method for CurveStyles.
void loadVersions7AndUp(QXmlStreamReader &reader, DocumentAxesPointsRequired documentAxesPointsRequired)
Load one CoordSystem from file in version 7 format or newer, into the most recent CoordSystem which w...
void loadVersion6(QXmlStreamReader &reader)
Load from file in version 6 format, into the single CoordSystem.
virtual DocumentModelColorFilter modelColorFilter() const
Get method for DocumentModelColorFilter.
virtual void setCurveAxes(const Curve &curveAxes)
Let CmdAbstract classes overwrite axes Curve. Applies to current coordinate system.
virtual void iterateThroughCurveSegments(const QString &curveName, const Functor2wRet< const Point &, const Point &, CallbackSearchReturn > &ftorWithCallback) const
See Curve::iterateThroughCurveSegments, for any axes or graph curve.
CoordSystemIndex coordSystemIndex() const
Index of current active CoordSystem.
virtual void setModelGridRemoval(const DocumentModelGridRemoval &modelGridRemoval)
Set method for DocumentModelGridRemoval.
void setModelExport(const DocumentModelExportFormat &modelExport)
Set method for DocumentModelExportFormat.
Model for DlgSettingsDigitizeCurve and CmdSettingsDigitizeCurve.
void editPointAxis(const QPointF &posGraph, const QString &identifier)
Edit the graph coordinates of a single axis point. Call this after checkAddPointAxis to guarantee suc...
virtual void setModelAxesChecker(const DocumentModelAxesChecker &modelAxesChecker)
Set method for DocumentModelAxesChecker.
void loadPreVersion6(QDataStream &str, double version)
Load from file in pre-version 6 format.
bool isXOnly(const QString &pointIdentifier) const
True/false if y/x value is empty.
Container for all graph curves. The axes point curve is external to this class.
Model for DlgSettingsColorFilter and CmdSettingsColorFilter.
virtual void setModelExport(const DocumentModelExportFormat &modelExport)
Set method for DocumentModelExportFormat.
void setModelPointMatch(const DocumentModelPointMatch &modelPointMatch)
Set method for DocumentModelPointMatch.
virtual void addPointsInCurvesGraphs(CurvesGraphs &curvesGraphs)
Add all points identified in the specified CurvesGraphs. See also removePointsInCurvesGraphs.
void setModelCurveStyles(const CurveStyles &modelCurveStyles)
Set method for CurveStyles.
CurveStyles modelCurveStyles() const
Get method for CurveStyles.
virtual QStringList curvesGraphsNames() const
See CurvesGraphs::curvesGraphsNames.
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 addGraphCurveAtEnd(const QString &curveName)
Add new graph curve to the list of existing graph curves.
void setCurveAxes(const Curve &curveAxes)
Let CmdAbstract classes overwrite axes Curve.
DocumentModelAxesChecker modelAxesChecker() const
Get method for DocumentModelAxesChecker.
void removePointsInCurvesGraphs(CurvesGraphs &curvesGraphs)
Remove all points identified in the specified CurvesGraphs. See also addPointsInCurvesGraphs.
This class initializes the count, start, step and stop parameters for one coordinate (either x/theta ...
DocumentModelDigitizeCurve modelDigitizeCurve() const
Get method for DocumentModelDigitizeCurve.
virtual void setModelDigitizeCurve(const DocumentModelDigitizeCurve &modelDigitizeCurve)
Set method for DocumentModelDigitizeCurve.
QString selectedCurveName() const
Currently selected curve name. This is used to set the selected curve combobox in MainWindow...
virtual void removePointGraph(const QString &identifier)
Perform the opposite of addPointGraph.
virtual void setModelSegments(const DocumentModelSegments &modelSegments)
Set method for DocumentModelSegments.
void setModelColorFilter(const DocumentModelColorFilter &modelColorFilter)
Set method for DocumentModelColorFilter.
Model for DlgSettingsCoords and CmdSettingsCoords.
QPointF positionGraph(const QString &pointIdentifier) const
See Curve::positionGraph.
virtual void removePointAxis(const QString &identifier)
Perform the opposite of addPointAxis.
Container for LineStyle and PointStyle for one Curve.
virtual DocumentModelAxesChecker modelAxesChecker() const
Get method for DocumentModelAxesChecker.
Container for one set of digitized Points.
DocumentModelGridDisplay initializeWithWidePolarCoverage(const QRectF &boundingRectGraph, const DocumentModelCoords &modelCoords, const Transformation &transformation, const QSize &imageSize) const
Initialize given the boundaries of the graph coordinates, and then extra processing for polar coordin...
virtual int nextOrdinalForCurve(const QString &curveName) const
Default next ordinal value for specified curve.
virtual QPointF positionGraph(const QString &pointIdentifier) const
See Curve::positionGraph.
QStringList curvesGraphsNames() const
See CurvesGraphs::curvesGraphsNames.
void print() const
Debugging method for printing directly from symbolic debugger.
Model for DlgSettingsAxesChecker and CmdSettingsAxesChecker.
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 setModelGeneral(const DocumentModelGeneral &modelGeneral)
Set method for DocumentModelGeneral.
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 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 QPointF positionScreen(const QString &pointIdentifier) const
See Curve::positionScreen.
void setDocumentAxesPointsRequired(DocumentAxesPointsRequired documentAxesPointsRequired)
Set the number of axes points required.
void iterateThroughCurveSegments(const QString &curveName, const Functor2wRet< const Point &, const Point &, CallbackSearchReturn > &ftorWithCallback) const
See Curve::iterateThroughCurveSegments, for any axes or graph curve.
CurveStyle curveStyle(const QString &curveName) const
CurveStyle in specified curve.
int nextOrdinalForCurve(const QString &curveName) const
Default next ordinal value for specified curve.
virtual void printStream(QString indentation, QTextStream &str) const
Debugging method that supports print method of this class and printStream method of some other class(...
bool stable() const
Get method for stable flag.
const CurvesGraphs & curvesGraphs() const
Make all Curves available, read only, for CmdAbstract classes only.
const Curve * curveForCurveName(const QString &curveName) const
See CurvesGraphs::curveForCurveNames, although this also works for AXIS_CURVE_NAME.
virtual void iterateThroughCurvePointsAxes(const Functor2wRet< const QString &, const Point &, CallbackSearchReturn > &ftorWithCallback)
See Curve::iterateThroughCurvePoints, for the axes curve.
virtual int curvesGraphsNumPoints(const QString &curveName) const
See CurvesGraphs::curvesGraphsNumPoints.
DocumentModelSegments modelSegments() const
Get method for DocumentModelSegments.
Model for DlgSettingsSegments and CmdSettingsSegments.
void iterateThroughCurvesPointsGraphs(const Functor2wRet< const QString &, const Point &, CallbackSearchReturn > &ftorWithCallback)
See Curve::iterateThroughCurvePoints, for all the graphs curves.
void setCurvesGraphs(const CurvesGraphs &curvesGraphs)
Let CmdAbstract classes overwrite CurvesGraphs.
virtual const CurvesGraphs & curvesGraphs() const
Make all Curves available, read only, for CmdAbstract classes only.
virtual void updatePointOrdinals(const Transformation &transformation)
Update point ordinals after point addition/removal or dragging.
virtual DocumentModelPointMatch modelPointMatch() const
Get method for DocumentModelPointMatch.
void addPointsInCurvesGraphs(CurvesGraphs &curvesGraphs)
Add all points identified in the specified CurvesGraphs. See also removePointsInCurvesGraphs.
Document(const QImage &image)
Constructor for imported images and dragged images. Only one coordinate system is create - others are...
virtual DocumentModelSegments modelSegments() const
Get method for DocumentModelSegments.
void editPointGraph(bool isX, bool isY, double x, double y, const QStringList &identifiers, const Transformation &transformation)
Edit the graph coordinates of one or more graph points.
void initializeGridDisplay(const Transformation &transformation)
Initialize grid display. This is called immediately after the transformation has been defined for the...
virtual void movePoint(const QString &pointIdentifier, const QPointF &deltaScreen)
See Curve::movePoint.
DocumentModelGridDisplay modelGridDisplay() const
Get method for DocumentModelGridDisplay.
void saveXml(QXmlStreamWriter &writer) const
Save document to xml.
virtual DocumentModelGridDisplay modelGridDisplay() const
Get method for DocumentModelGridDisplay.
const ColorFilterSettingsList & colorFilterSettingsList() const
Get method for copying all color filters in one step.
virtual DocumentModelCoords modelCoords() const
Get method for DocumentModelCoords.
Model for DlgSettingsGridRemoval and CmdSettingsGridRemoval. The settings are unstable until the user...
QString reasonForUnsuccessfulRead() const
Return an informative text message explaining why startup loading failed. Applies if successfulRead r...
Callback for computing the bounding rectangles of the screen and graph coordinates of the points in t...
DocumentModelGridRemoval modelGridRemoval() const
Get method for DocumentModelGridRemoval.
void updatePointOrdinals(const Transformation &transformation)
Update point ordinals after point addition/removal or dragging.
DocumentModelExportFormat modelExport() const
Get method for DocumentModelExportFormat.
void setCoordSystemIndex(CoordSystemIndex coordSystemIndex)
Index of current CoordSystem.
void setSelectedCurveName(const QString &selectedCurveName)
Save curve name that is selected for the current coordinate system, for the next time the coordinate ...
DocumentModelGeneral modelGeneral() const
Get method for DocumentModelGeneral.
virtual void iterateThroughCurvesPointsGraphs(const Functor2wRet< const QString &, const Point &, CallbackSearchReturn > &ftorWithCallback)
See Curve::iterateThroughCurvePoints, for all the graphs curves.
virtual DocumentModelDigitizeCurve modelDigitizeCurve() const
Get method for DocumentModelDigitizeCurve.