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" 18 #include "EnumsToQt.h" 21 #include "OrdinalGenerator.h" 24 #include <QDataStream> 26 #include <QDomDocument> 30 #include <QtToString.h> 31 #include <QXmlStreamReader> 32 #include <QXmlStreamWriter> 33 #include "SettingsForGraph.h" 34 #include "Transformation.h" 38 const int FOUR_BYTES = 4;
39 const int NOMINAL_COORD_SYSTEM_COUNT = 1;
40 const int VERSION_6 = 6;
41 const 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";
217 bool 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";
340 void 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";
399 void 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"));
434 void Document::loadPreVersion6 (QDataStream &str)
436 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::loadPreVersion6";
442 m_documentAxesPointsRequired = DOCUMENT_AXES_POINTS_REQUIRED_3;
455 void 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();
525 void 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";
844 QStringList curveNames = modelCurveStyles.
curveNames();
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";
910 int 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();
void addCoordSystems(unsigned int numberCoordSystemToAdd)
Add some number (0 or more) of additional coordinate systems.
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.
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...
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 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.
void setCurvesGraphs(CoordSystemIndex coordSystemIndex, const CurvesGraphs &curvesGraphs)
Applies to current coordinate system.
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 checkEditPointAxis(const QString &pointIdentifier, const QPointF &posScreen, const QPointF &posGraph, bool &isError, QString &errorMessage)
Check before calling editPointAxis.
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 CurveStyles modelCurveStyles() const
Get method for CurveStyles.
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 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.
DocumentModelAxesChecker modelAxesChecker() const
Get method for DocumentModelAxesChecker.
void removePointsInCurvesGraphs(CurvesGraphs &curvesGraphs)
Remove all points identified in the specified CurvesGraphs. See also addPointsInCurvesGraphs.
DocumentModelDigitizeCurve modelDigitizeCurve() const
Get method for DocumentModelDigitizeCurve.
virtual void setModelDigitizeCurve(const DocumentModelDigitizeCurve &modelDigitizeCurve)
Set method for DocumentModelDigitizeCurve.
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.
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 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(...
const CurvesGraphs & curvesGraphs() const
Make all Curves available, read only, for CmdAbstract classes only.
void loadVersion7(QXmlStreamReader &reader, DocumentAxesPointsRequired documentAxesPointsRequired)
Load one CoordSystem from file in version 7 format, into the most recent CoordSystem which was just c...
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.
virtual void movePoint(const QString &pointIdentifier, const QPointF &deltaScreen)
See Curve::movePoint.
void saveXml(QXmlStreamWriter &writer) const
Save document to xml.
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...
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.
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.