7#include "CallbackAddPointsInCurvesGraphs.h"
8#include "CallbackCheckAddPointAxis.h"
9#include "CallbackCheckEditPointAxis.h"
10#include "CallbackNextOrdinal.h"
11#include "CallbackRemovePointsInCurvesGraphs.h"
13#include "CurvesGraphs.h"
14#include "CurveStyles.h"
16#include "DocumentSerialize.h"
17#include "EngaugeAssert.h"
21#include "OrdinalGenerator.h"
26#include <QDomDocument>
30#include <QtToString.h>
31#include <QXmlStreamReader>
32#include <QXmlStreamWriter>
33#include "SettingsForGraph.h"
34#include "Transformation.h"
38const int FOUR_BYTES = 4;
39const int NOMINAL_COORD_SYSTEM_COUNT = 1;
40const int VERSION_6 = 6;
41const int VERSION_7 = 7;
45 m_documentAxesPointsRequired (DOCUMENT_AXES_POINTS_REQUIRED_3)
47 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::Document"
48 <<
" image=" << image.width() <<
"x" << image.height();
51 NOMINAL_COORD_SYSTEM_COUNT);
53 m_successfulRead =
true;
55 m_pixmap.convertFromImage (image);
60 m_documentAxesPointsRequired (DOCUMENT_AXES_POINTS_REQUIRED_3)
62 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::Document"
63 <<
" fileName=" << fileName.toLatin1().data();
65 m_successfulRead =
true;
68 QFile *file =
new QFile (fileName);
69 if (file->open(QIODevice::ReadOnly)) {
71 QByteArray bytesStart = file->read (FOUR_BYTES);
74 if (bytesIndicatePreVersion6 (bytesStart)) {
76 QFile *file =
new QFile (fileName);
77 if (file->open (QIODevice::ReadOnly)) {
78 QDataStream str (file);
81 NOMINAL_COORD_SYSTEM_COUNT);
82 loadPreVersion6 (str);
86 m_successfulRead =
false;
87 m_reasonForUnsuccessfulRead = QObject::tr (
"Operating system says file is not readable");
92 QFile *file =
new QFile (fileName);
93 if (file->open (QIODevice::ReadOnly | QIODevice::Text)) {
95 int version = versionFromFile (file);
107 m_successfulRead =
false;
108 m_reasonForUnsuccessfulRead = QString (
"Engauge %1 %2 %3 %4 Engauge")
109 .arg (VERSION_NUMBER)
110 .arg (QObject::tr (
"cannot read newer files from version"))
112 .arg (QObject::tr (
"of"));
123 m_successfulRead =
false;
124 m_reasonForUnsuccessfulRead = QObject::tr (
"Operating system says file is not readable");
129 m_successfulRead =
false;
130 m_reasonForUnsuccessfulRead = QString (
"%1 '%2' %3")
131 .arg (QObject::tr (
"File"))
133 .arg (QObject::tr (
"was not found"));
140 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::addCoordSystems"
141 <<
" toAdd=" << numberCoordSystemToAdd;
144 numberCoordSystemToAdd);
149 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::addGraphCurveAtEnd";
155 const QPointF &posGraph,
160 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::addPointAxisWithGeneratedIdentifier";
170 const QPointF &posGraph,
171 const QString &identifier,
175 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::addPointAxisWithSpecifiedIdentifier";
185 const QPointF &posScreen,
189 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::addPointGraphWithGeneratedIdentifier";
198 const QPointF &posScreen,
199 const QString &identifier,
202 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::addPointGraphWithSpecifiedIdentifier";
212 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::addPointsInCurvesGraphs";
217bool Document::bytesIndicatePreVersion6 (
const QByteArray &bytes)
const
219 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::bytesIndicatePreVersion6";
221 QByteArray preVersion6MagicNumber;
222 preVersion6MagicNumber.resize (FOUR_BYTES);
225 preVersion6MagicNumber[0] =
'\x00';
226 preVersion6MagicNumber[1] =
'\x00';
227 preVersion6MagicNumber[2] =
'\xCA';
228 preVersion6MagicNumber[3] =
'\xFE';
230 return (bytes == preVersion6MagicNumber);
234 const QPointF &posGraph,
236 QString &errorMessage,
239 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::checkAddPointAxis";
249 const QPointF &posScreen,
250 const QPointF &posGraph,
252 QString &errorMessage)
254 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::checkEditPointAxis";
265 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::coordSystem";
272 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::coordSystemCount";
279 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::coordSystemIndex";
286 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::curveAxes";
293 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::curveForCurveName";
300 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::curveForCurveName";
307 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::curvesGraphs";
314 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::curvesGraphsNames";
321 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::curvesGraphsNumPoints";
328 return m_documentAxesPointsRequired;
332 const QString &identifier)
334 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::editPointAxis";
340void Document::generateEmptyPixmap(
const QXmlStreamAttributes &attributes)
342 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::generateEmptyPixmap";
344 int width = 800, height = 500;
346 if (attributes.hasAttribute (DOCUMENT_SERIALIZE_IMAGE_WIDTH) &&
347 attributes.hasAttribute (DOCUMENT_SERIALIZE_IMAGE_HEIGHT)) {
349 width = attributes.value (DOCUMENT_SERIALIZE_IMAGE_WIDTH).toInt();
350 height = attributes.value (DOCUMENT_SERIALIZE_IMAGE_HEIGHT).toInt();
354 m_pixmap = QPixmap (width, height);
359 return m_coordSystemContext.
isXOnly (pointIdentifier);
364 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::iterateThroughCurvePointsAxes";
371 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::iterateThroughCurvePointsAxes";
377 const Functor2wRet<const Point &, const Point &, CallbackSearchReturn> &ftorWithCallback)
const
379 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::iterateThroughCurveSegments";
387 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::iterateThroughCurvesPointsGraphs";
394 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::iterateThroughCurvesPointsGraphs";
399void Document::loadImage(QXmlStreamReader &reader)
401 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::loadImage";
403 loadNextFromReader(reader);
404 if (reader.isCDATA ()) {
407 QByteArray array64 = reader.text().toString().toUtf8();
411 array = QByteArray::fromBase64(array64);
414 QDataStream str (&array, QIODevice::ReadOnly);
415 QImage img = m_pixmap.toImage ();
417 m_pixmap = QPixmap::fromImage (img);
420 while ((reader.tokenType() != QXmlStreamReader::EndElement) ||
421 (reader.name() != DOCUMENT_SERIALIZE_IMAGE)){
422 loadNextFromReader(reader);
430 reader.raiseError (QObject::tr (
"Cannot read image data"));
434void Document::loadPreVersion6 (QDataStream &str)
436 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::loadPreVersion6";
442 m_documentAxesPointsRequired = DOCUMENT_AXES_POINTS_REQUIRED_3;
455void Document::loadVersion6 (QFile *file)
457 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::loadVersion6";
459 QXmlStreamReader reader (file);
461 m_documentAxesPointsRequired = DOCUMENT_AXES_POINTS_REQUIRED_3;
465 NOMINAL_COORD_SYSTEM_COUNT);
469 bool inDocumentSubtree =
false;
472 while (!reader.atEnd() &&
473 !reader.hasError()) {
474 QXmlStreamReader::TokenType tokenType = loadNextFromReader(reader);
477 if ((reader.name() == DOCUMENT_SERIALIZE_IMAGE) &&
478 (tokenType == QXmlStreamReader::StartElement)) {
480 generateEmptyPixmap (reader.attributes());
484 if ((reader.name() == DOCUMENT_SERIALIZE_DOCUMENT) &&
485 (tokenType == QXmlStreamReader::StartElement)) {
487 inDocumentSubtree =
true;
489 }
else if ((reader.name() == DOCUMENT_SERIALIZE_DOCUMENT) &&
490 (tokenType == QXmlStreamReader::EndElement)) {
496 if (inDocumentSubtree) {
499 if (tokenType == QXmlStreamReader::StartElement) {
502 QString tag = reader.name().toString();
503 if (tag == DOCUMENT_SERIALIZE_IMAGE) {
516 if (reader.hasError ()) {
518 m_successfulRead =
false;
519 m_reasonForUnsuccessfulRead = reader.errorString();
525void Document::loadVersion7 (QFile *file)
527 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::loadVersion7";
529 const int ONE_COORDINATE_SYSTEM = 1;
531 QXmlStreamReader reader (file);
535 bool inDocumentSubtree =
false;
538 while (!reader.atEnd() &&
539 !reader.hasError()) {
540 QXmlStreamReader::TokenType tokenType = loadNextFromReader(reader);
543 if ((reader.name() == DOCUMENT_SERIALIZE_IMAGE) &&
544 (tokenType == QXmlStreamReader::StartElement)) {
546 generateEmptyPixmap (reader.attributes());
550 if ((reader.name() == DOCUMENT_SERIALIZE_DOCUMENT) &&
551 (tokenType == QXmlStreamReader::StartElement)) {
553 inDocumentSubtree =
true;
555 QXmlStreamAttributes attributes = reader.attributes();
556 if (attributes.hasAttribute (DOCUMENT_SERIALIZE_AXES_POINTS_REQUIRED)) {
557 m_documentAxesPointsRequired = (DocumentAxesPointsRequired) attributes.value (DOCUMENT_SERIALIZE_AXES_POINTS_REQUIRED).toInt();
559 m_documentAxesPointsRequired = DOCUMENT_AXES_POINTS_REQUIRED_3;
562 }
else if ((reader.name() == DOCUMENT_SERIALIZE_DOCUMENT) &&
563 (tokenType == QXmlStreamReader::EndElement)) {
569 if (inDocumentSubtree) {
572 if (tokenType == QXmlStreamReader::StartElement) {
575 QString tag = reader.name().toString();
576 if (tag == DOCUMENT_SERIALIZE_COORD_SYSTEM) {
578 ONE_COORDINATE_SYSTEM);
580 m_documentAxesPointsRequired);
581 }
else if (tag == DOCUMENT_SERIALIZE_IMAGE) {
588 if (reader.hasError ()) {
590 m_successfulRead =
false;
591 m_reasonForUnsuccessfulRead = reader.errorString();
599 LOG4CPP_DEBUG_S ((*mainCat)) <<
"Document::modelAxesChecker";
606 LOG4CPP_DEBUG_S ((*mainCat)) <<
"Document::modelColorFilter";
613 LOG4CPP_DEBUG_S ((*mainCat)) <<
"Document::modelCoords";
620 LOG4CPP_DEBUG_S ((*mainCat)) <<
"Document::modelCurveStyles";
627 LOG4CPP_DEBUG_S ((*mainCat)) <<
"Document::modelDigitizeCurve";
634 LOG4CPP_DEBUG_S ((*mainCat)) <<
"Document::modelExport";
641 LOG4CPP_DEBUG_S ((*mainCat)) <<
"Document::modelGeneral";
648 LOG4CPP_DEBUG_S ((*mainCat)) <<
"Document::modelGridRemoval";
655 LOG4CPP_DEBUG_S ((*mainCat)) <<
"Document::modelPointMatch";
662 LOG4CPP_DEBUG_S ((*mainCat)) <<
"Document::modelSegments";
668 const QPointF &deltaScreen)
670 m_coordSystemContext.
movePoint (pointIdentifier,
676 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::nextOrdinalForCurve";
699 QTextStream str (&text);
703 std::cerr << text.toLatin1().data();
707 QTextStream &str)
const
709 str << indentation <<
"Document\n";
711 indentation += INDENTATION_DELTA;
713 str << indentation <<
"name=" << m_name <<
"\n";
714 str << indentation <<
"pixmap=" << m_pixmap.width() <<
"x" << m_pixmap.height() <<
"\n";
722 ENGAUGE_ASSERT (!m_successfulRead);
724 return m_reasonForUnsuccessfulRead;
729 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::removePointAxis";
736 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::removePointGraph";
743 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::removePointsInCurvesGraphs";
750 writer.writeStartElement(DOCUMENT_SERIALIZE_DOCUMENT);
754 writer.writeAttribute(DOCUMENT_SERIALIZE_APPLICATION_VERSION_NUMBER, VERSION_NUMBER);
757 writer.writeAttribute(DOCUMENT_SERIALIZE_AXES_POINTS_REQUIRED, QString::number (m_documentAxesPointsRequired));
761 QDataStream str (&array, QIODevice::WriteOnly);
762 QImage img = m_pixmap.toImage ();
764 writer.writeStartElement(DOCUMENT_SERIALIZE_IMAGE);
768 writer.writeAttribute(DOCUMENT_SERIALIZE_IMAGE_WIDTH, QString::number (img.width()));
769 writer.writeAttribute(DOCUMENT_SERIALIZE_IMAGE_HEIGHT, QString::number (img.height()));
771 writer.writeCDATA (array.toBase64 ());
772 writer.writeEndElement();
774 m_coordSystemContext.
saveXml (writer);
779 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setCoordSystemIndex";
786 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setCurvesGraphs";
794 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setCurvesGraphs";
802 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setDocumentAxesPointsRequired";
809 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setModelAxesChecker";
816 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setModelColorFilter";
819 ColorFilterSettingsList::const_iterator itr;
824 QString curveName = itr.key();
834 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setModelCoords";
841 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setModelCurveStyles";
845 QStringList::iterator itr;
846 for (itr = curveNames.begin(); itr != curveNames.end(); itr++) {
848 QString curveName = *itr;
858 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setModelDigitizeCurve";
865 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setModelExport";
872 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setModelGeneral";
879 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setModelGridRemoval";
886 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setModelPointMatch";
893 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setModelSegments";
900 return m_successfulRead;
905 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::updatePointOrdinals";
910int Document::versionFromFile (QFile *file)
const
912 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::versionFromFile";
914 int version = VERSION_6;
917 if (doc.setContent (file)) {
919 QDomNodeList nodes = doc.elementsByTagName (DOCUMENT_SERIALIZE_DOCUMENT);
920 if (nodes.count() > 0) {
921 QDomNode node = nodes.at (0);
923 QDomNamedNodeMap attributes = node.attributes();
925 if (attributes.contains (DOCUMENT_SERIALIZE_APPLICATION_VERSION_NUMBER)) {
927 QDomElement elem = node.toElement();
928 version = (int) elem.attribute (DOCUMENT_SERIALIZE_APPLICATION_VERSION_NUMBER).toDouble();
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 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 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.
void setCurvesGraphs(CoordSystemIndex coordSystemIndex, const CurvesGraphs &curvesGraphs)
Applies to current coordinate system.
const CoordSystem & coordSystem() const
Current CoordSystem.
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.
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.
virtual int curvesGraphsNumPoints(const QString &curveName) const
See CurvesGraphs::curvesGraphsNumPoints.
void loadVersion6(QXmlStreamReader &reader)
Load from file in version 6 format, into the single CoordSystem.
virtual QPointF positionScreen(const QString &pointIdentifier) const
See Curve::positionScreen.
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 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...
void loadVersion7(QXmlStreamReader &reader, DocumentAxesPointsRequired documentAxesPointsRequired)
Load one CoordSystem from file in version 7 format, into the most recent CoordSystem which was just c...
void addCoordSystems(DocumentAxesPointsRequired documentAxesPointsRequired, unsigned int numberCoordSystemToAdd)
Add specified number of coordinate systems to the original one created by the constructor.
virtual void saveXml(QXmlStreamWriter &writer) const
Save graph to xml.
virtual void setModelExport(const DocumentModelExportFormat &modelExport)
Set method for DocumentModelExportFormat.
virtual void removePointGraph(const QString &identifier)
Perform the opposite of addPointGraph.
virtual void checkEditPointAxis(const QString &pointIdentifier, const QPointF &posScreen, const QPointF &posGraph, bool &isError, QString &errorMessage)
Check before calling editPointAxis.
void setCoordSystemIndex(CoordSystemIndex coordSystemIndex)
Index of current CoordSystem.
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 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 iterateThroughCurvesPointsGraphs(const Functor2wRet< const QString &, const Point &, CallbackSearchReturn > &ftorWithCallback)
See Curve::iterateThroughCurvePoints, for all the graphs curves.
void loadPreVersion6(QDataStream &str, double version)
Load from file in pre-version 6 format.
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.
Container for LineStyle and PointStyle for one Curve.
Model for DlgSettingsCurveProperties and CmdSettingsCurveProperties.
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.
void setCurveStyle(const CurveStyle &curveStyle)
Set curve style.
void setColorFilterSettings(const ColorFilterSettings &colorFilterSettings)
Set color filter.
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 DlgSettingsGeneral and CmdSettingsGeneral.
Model for DlgSettingsGridRemoval and CmdSettingsGridRemoval. The settings are unstable until the user...
Model for DlgSettingsPointMatch and CmdSettingsPointMatch.
Model for DlgSettingsSegments and CmdSettingsSegments.
QPointF positionScreen(const QString &pointIdentifier) const
See Curve::positionScreen.
unsigned int coordSystemCount() const
Number of CoordSystem.
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 iterateThroughCurveSegments(const QString &curveName, const Functor2wRet< const Point &, const Point &, CallbackSearchReturn > &ftorWithCallback) const
See Curve::iterateThroughCurveSegments, for any axes or graph curve.
void setModelGridRemoval(const DocumentModelGridRemoval &modelGridRemoval)
Set method for DocumentModelGridRemoval.
void setCoordSystemIndex(CoordSystemIndex coordSystemIndex)
Set the index of current active CoordSystem.
void iterateThroughCurvePointsAxes(const Functor2wRet< const QString &, const Point &, CallbackSearchReturn > &ftorWithCallback)
See Curve::iterateThroughCurvePoints, for the axes curve.
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.
QPixmap pixmap() const
Return the image that is being digitized.
void setDocumentAxesPointsRequired(DocumentAxesPointsRequired documentAxesPointsRequired)
Set the number of axes points required.
DocumentModelGeneral modelGeneral() const
Get method for DocumentModelGeneral.
void addPointAxisWithGeneratedIdentifier(const QPointF &posScreen, const QPointF &posGraph, QString &identifier, double ordinal, bool isXOnly)
Add a single axis point with a generated point identifier.
QPointF positionGraph(const QString &pointIdentifier) const
See Curve::positionGraph.
const Curve & curveAxes() const
Get method for axis curve.
CoordSystemIndex coordSystemIndex() const
Index of current active CoordSystem.
void iterateThroughCurvesPointsGraphs(const Functor2wRet< const QString &, const Point &, CallbackSearchReturn > &ftorWithCallback)
See Curve::iterateThroughCurvePoints, for all the graphs curves.
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...
QStringList curvesGraphsNames() const
See CurvesGraphs::curvesGraphsNames.
bool isXOnly(const QString &pointIdentifier) const
See Curve::isXOnly.
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...
void removePointGraph(const QString &identifier)
Perform the opposite of addPointGraph.
void setModelCurveStyles(const CurveStyles &modelCurveStyles)
Set method for CurveStyles.
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.
const CoordSystem & coordSystem() const
Currently active CoordSystem.
DocumentModelPointMatch modelPointMatch() const
Get method for DocumentModelPointMatch.
DocumentModelDigitizeCurve modelDigitizeCurve() const
Get method for DocumentModelDigitizeCurve.
int nextOrdinalForCurve(const QString &curveName) const
Default next ordinal value for specified curve.
void removePointsInCurvesGraphs(CurvesGraphs &curvesGraphs)
Remove all points identified in the specified CurvesGraphs. See also addPointsInCurvesGraphs.
void print() const
Debugging method for printing directly from symbolic debugger.
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.
void addGraphCurveAtEnd(const QString &curveName)
Add new graph curve to the list of existing graph curves.
void setModelColorFilter(const DocumentModelColorFilter &modelColorFilter)
Set method for DocumentModelColorFilter.
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...
void saveXml(QXmlStreamWriter &writer) const
Save document to xml.
DocumentModelAxesChecker modelAxesChecker() const
Get method for DocumentModelAxesChecker.
DocumentModelCoords modelCoords() const
Get method for DocumentModelCoords.
DocumentModelColorFilter modelColorFilter() const
Get method for DocumentModelColorFilter.
void checkEditPointAxis(const QString &pointIdentifier, const QPointF &posScreen, const QPointF &posGraph, bool &isError, QString &errorMessage)
Check before calling editPointAxis.
void setCurvesGraphs(const CurvesGraphs &curvesGraphs)
Let CmdAbstract classes overwrite CurvesGraphs.
CurveStyles modelCurveStyles() const
Get method for CurveStyles.
void setModelCoords(const DocumentModelCoords &modelCoords)
Set method for DocumentModelCoords.
void setModelAxesChecker(const DocumentModelAxesChecker &modelAxesChecker)
Set method for DocumentModelAxesChecker.
DocumentAxesPointsRequired documentAxesPointsRequired() const
Get method for DocumentAxesPointsRequired.
void setModelSegments(const DocumentModelSegments &modelSegments)
Set method for DocumentModelSegments.
const CurvesGraphs & curvesGraphs() const
Make all Curves available, read only, for CmdAbstract classes only.
int curvesGraphsNumPoints(const QString &curveName) const
See CurvesGraphs::curvesGraphsNumPoints.
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.
DocumentModelExportFormat modelExport() const
Get method for DocumentModelExportFormat.
void movePoint(const QString &pointIdentifier, const QPointF &deltaScreen)
See Curve::movePoint.
const Curve * curveForCurveName(const QString &curveName) const
See CurvesGraphs::curveForCurveNames, although this also works for AXIS_CURVE_NAME.
DocumentModelSegments modelSegments() const
Get method for DocumentModelSegments.
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...
void removePointAxis(const QString &identifier)
Perform the opposite of addPointAxis.
void addPointGraphWithGeneratedIdentifier(const QString &curveName, const QPointF &posScreen, QString &generatedIentifier, double ordinal)
Add a single graph point with a generated point identifier.
void addPointsInCurvesGraphs(CurvesGraphs &curvesGraphs)
Add all points identified in the specified CurvesGraphs. See also removePointsInCurvesGraphs.