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;
49 m_documentAxesPointsRequired (DOCUMENT_AXES_POINTS_REQUIRED_3)
51 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::Document"
52 <<
" image=" << image.width() <<
"x" << image.height();
55 NOMINAL_COORD_SYSTEM_COUNT);
57 m_successfulRead =
true;
59 m_pixmap.convertFromImage (image);
64 m_documentAxesPointsRequired (DOCUMENT_AXES_POINTS_REQUIRED_3)
66 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::Document"
67 <<
" fileName=" << fileName.toLatin1().data();
69 m_successfulRead =
true;
72 QFile *file =
new QFile (fileName);
73 if (file->open(QIODevice::ReadOnly)) {
75 QByteArray bytesStart = file->read (FOUR_BYTES);
78 if (bytesIndicatePreVersion6 (bytesStart)) {
80 QFile *file =
new QFile (fileName);
81 if (file->open (QIODevice::ReadOnly)) {
82 QDataStream str (file);
85 NOMINAL_COORD_SYSTEM_COUNT);
86 loadPreVersion6 (str);
90 m_successfulRead =
false;
91 m_reasonForUnsuccessfulRead = QObject::tr (
"Operating system says file is not readable");
96 QFile *file =
new QFile (fileName);
97 if (file->open (QIODevice::ReadOnly | QIODevice::Text)) {
99 int version = versionFromFile (file);
108 loadVersions7AndUp (file);
112 m_successfulRead =
false;
113 m_reasonForUnsuccessfulRead = QString (
"Engauge %1 %2 %3 %4 Engauge")
114 .arg (VERSION_NUMBER)
115 .arg (QObject::tr (
"cannot read newer files from version"))
117 .arg (QObject::tr (
"of"));
128 m_successfulRead =
false;
129 m_reasonForUnsuccessfulRead = QObject::tr (
"Operating system says file is not readable");
134 m_successfulRead =
false;
135 m_reasonForUnsuccessfulRead = QString (
"%1 '%2' %3")
136 .arg (QObject::tr (
"File"))
138 .arg (QObject::tr (
"was not found"));
145 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::addCoordSystems"
146 <<
" toAdd=" << numberCoordSystemToAdd;
149 numberCoordSystemToAdd);
154 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::addGraphCurveAtEnd";
160 const QPointF &posGraph,
165 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::addPointAxisWithGeneratedIdentifier";
175 const QPointF &posGraph,
176 const QString &identifier,
180 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::addPointAxisWithSpecifiedIdentifier";
190 const QPointF &posScreen,
194 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::addPointGraphWithGeneratedIdentifier";
203 const QPointF &posScreen,
204 const QString &identifier,
207 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::addPointGraphWithSpecifiedIdentifier";
217 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::addPointsInCurvesGraphs";
222 bool Document::bytesIndicatePreVersion6 (
const QByteArray &bytes)
const
224 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::bytesIndicatePreVersion6";
226 QByteArray preVersion6MagicNumber;
227 preVersion6MagicNumber.resize (FOUR_BYTES);
230 preVersion6MagicNumber[0] =
'\x00';
231 preVersion6MagicNumber[1] =
'\x00';
232 preVersion6MagicNumber[2] =
'\xCA';
233 preVersion6MagicNumber[3] =
'\xFE';
235 return (bytes == preVersion6MagicNumber);
239 const QPointF &posGraph,
241 QString &errorMessage,
244 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::checkAddPointAxis";
254 const QPointF &posScreen,
255 const QPointF &posGraph,
257 QString &errorMessage)
259 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::checkEditPointAxis";
270 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::coordSystem";
277 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::coordSystemCount";
284 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::coordSystemIndex";
291 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::curveAxes";
298 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::curveForCurveName";
305 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::curveForCurveName";
312 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::curvesGraphs";
319 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::curvesGraphsNames";
326 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::curvesGraphsNumPoints";
333 return m_documentAxesPointsRequired;
337 const QString &identifier)
339 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::editPointAxis";
345 void Document::generateEmptyPixmap(
const QXmlStreamAttributes &attributes)
347 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::generateEmptyPixmap";
349 int width = 800, height = 500;
351 if (attributes.hasAttribute (DOCUMENT_SERIALIZE_IMAGE_WIDTH) &&
352 attributes.hasAttribute (DOCUMENT_SERIALIZE_IMAGE_HEIGHT)) {
354 width = attributes.value (DOCUMENT_SERIALIZE_IMAGE_WIDTH).toInt();
355 height = attributes.value (DOCUMENT_SERIALIZE_IMAGE_HEIGHT).toInt();
359 m_pixmap = QPixmap (width, height);
364 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::initializeGridDisplay";
371 Functor2wRet<const QString &, const Point &, CallbackSearchReturn> ftorWithCallback = functor_ret (ftor,
378 QRectF boundingRectGraph = ftor.boundingRectGraph(isEmpty);
394 return m_coordSystemContext.
isXOnly (pointIdentifier);
399 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::iterateThroughCurvePointsAxes";
406 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::iterateThroughCurvePointsAxes";
412 const Functor2wRet<const Point &, const Point &, CallbackSearchReturn> &ftorWithCallback)
const
414 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::iterateThroughCurveSegments";
422 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::iterateThroughCurvesPointsGraphs";
429 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::iterateThroughCurvesPointsGraphs";
434 void Document::loadImage(QXmlStreamReader &reader)
436 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::loadImage";
438 loadNextFromReader(reader);
439 if (reader.isCDATA ()) {
442 QByteArray array64 = reader.text().toString().toUtf8();
446 array = QByteArray::fromBase64(array64);
449 QDataStream str (&array, QIODevice::ReadOnly);
450 QImage img = m_pixmap.toImage ();
452 m_pixmap = QPixmap::fromImage (img);
455 while ((reader.tokenType() != QXmlStreamReader::EndElement) ||
456 (reader.name() != DOCUMENT_SERIALIZE_IMAGE)){
457 loadNextFromReader(reader);
465 reader.raiseError (QObject::tr (
"Cannot read image data"));
469 void Document::loadPreVersion6 (QDataStream &str)
471 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::loadPreVersion6";
477 m_documentAxesPointsRequired = DOCUMENT_AXES_POINTS_REQUIRED_3;
490 void Document::loadVersion6 (QFile *file)
492 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::loadVersion6";
494 QXmlStreamReader reader (file);
496 m_documentAxesPointsRequired = DOCUMENT_AXES_POINTS_REQUIRED_3;
500 NOMINAL_COORD_SYSTEM_COUNT);
504 bool inDocumentSubtree =
false;
507 while (!reader.atEnd() &&
508 !reader.hasError()) {
509 QXmlStreamReader::TokenType tokenType = loadNextFromReader(reader);
512 if ((reader.name() == DOCUMENT_SERIALIZE_IMAGE) &&
513 (tokenType == QXmlStreamReader::StartElement)) {
515 generateEmptyPixmap (reader.attributes());
519 if ((reader.name() == DOCUMENT_SERIALIZE_DOCUMENT) &&
520 (tokenType == QXmlStreamReader::StartElement)) {
522 inDocumentSubtree =
true;
524 }
else if ((reader.name() == DOCUMENT_SERIALIZE_DOCUMENT) &&
525 (tokenType == QXmlStreamReader::EndElement)) {
531 if (inDocumentSubtree) {
534 if (tokenType == QXmlStreamReader::StartElement) {
537 QString tag = reader.name().toString();
538 if (tag == DOCUMENT_SERIALIZE_IMAGE) {
551 if (reader.hasError ()) {
553 m_successfulRead =
false;
554 m_reasonForUnsuccessfulRead = reader.errorString();
560 void Document::loadVersions7AndUp (QFile *file)
562 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::loadVersions7AndUp";
564 const int ONE_COORDINATE_SYSTEM = 1;
566 QXmlStreamReader reader (file);
570 bool inDocumentSubtree =
false;
573 while (!reader.atEnd() &&
574 !reader.hasError()) {
575 QXmlStreamReader::TokenType tokenType = loadNextFromReader(reader);
578 if ((reader.name() == DOCUMENT_SERIALIZE_IMAGE) &&
579 (tokenType == QXmlStreamReader::StartElement)) {
581 generateEmptyPixmap (reader.attributes());
585 if ((reader.name() == DOCUMENT_SERIALIZE_DOCUMENT) &&
586 (tokenType == QXmlStreamReader::StartElement)) {
588 inDocumentSubtree =
true;
590 QXmlStreamAttributes attributes = reader.attributes();
591 if (attributes.hasAttribute (DOCUMENT_SERIALIZE_AXES_POINTS_REQUIRED)) {
592 m_documentAxesPointsRequired = (DocumentAxesPointsRequired) attributes.value (DOCUMENT_SERIALIZE_AXES_POINTS_REQUIRED).toInt();
594 m_documentAxesPointsRequired = DOCUMENT_AXES_POINTS_REQUIRED_3;
597 }
else if ((reader.name() == DOCUMENT_SERIALIZE_DOCUMENT) &&
598 (tokenType == QXmlStreamReader::EndElement)) {
604 if (inDocumentSubtree) {
607 if (tokenType == QXmlStreamReader::StartElement) {
610 QString tag = reader.name().toString();
611 if (tag == DOCUMENT_SERIALIZE_COORD_SYSTEM) {
613 ONE_COORDINATE_SYSTEM);
615 m_documentAxesPointsRequired);
616 }
else if (tag == DOCUMENT_SERIALIZE_IMAGE) {
623 if (reader.hasError ()) {
625 m_successfulRead =
false;
626 m_reasonForUnsuccessfulRead = reader.errorString();
634 LOG4CPP_DEBUG_S ((*mainCat)) <<
"Document::modelAxesChecker";
641 LOG4CPP_DEBUG_S ((*mainCat)) <<
"Document::modelColorFilter";
648 LOG4CPP_DEBUG_S ((*mainCat)) <<
"Document::modelCoords";
655 LOG4CPP_DEBUG_S ((*mainCat)) <<
"Document::modelCurveStyles";
662 LOG4CPP_DEBUG_S ((*mainCat)) <<
"Document::modelDigitizeCurve";
669 LOG4CPP_DEBUG_S ((*mainCat)) <<
"Document::modelExport";
676 LOG4CPP_DEBUG_S ((*mainCat)) <<
"Document::modelGeneral";
683 LOG4CPP_DEBUG_S ((*mainCat)) <<
"Document::modelGridDisplay";
690 LOG4CPP_DEBUG_S ((*mainCat)) <<
"Document::modelGridRemoval";
697 LOG4CPP_DEBUG_S ((*mainCat)) <<
"Document::modelPointMatch";
704 LOG4CPP_DEBUG_S ((*mainCat)) <<
"Document::modelSegments";
710 const QPointF &deltaScreen)
712 m_coordSystemContext.
movePoint (pointIdentifier,
718 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::nextOrdinalForCurve";
741 QTextStream str (&text);
745 std::cerr << text.toLatin1().data();
749 QTextStream &str)
const
751 str << indentation <<
"Document\n";
753 indentation += INDENTATION_DELTA;
755 str << indentation <<
"name=" << m_name <<
"\n";
756 str << indentation <<
"pixmap=" << m_pixmap.width() <<
"x" << m_pixmap.height() <<
"\n";
764 ENGAUGE_ASSERT (!m_successfulRead);
766 return m_reasonForUnsuccessfulRead;
771 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::removePointAxis";
778 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::removePointGraph";
785 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::removePointsInCurvesGraphs";
792 writer.writeStartElement(DOCUMENT_SERIALIZE_DOCUMENT);
796 writer.writeAttribute(DOCUMENT_SERIALIZE_APPLICATION_VERSION_NUMBER, VERSION_NUMBER);
799 writer.writeAttribute(DOCUMENT_SERIALIZE_AXES_POINTS_REQUIRED, QString::number (m_documentAxesPointsRequired));
803 QDataStream str (&array, QIODevice::WriteOnly);
804 QImage img = m_pixmap.toImage ();
806 writer.writeStartElement(DOCUMENT_SERIALIZE_IMAGE);
810 writer.writeAttribute(DOCUMENT_SERIALIZE_IMAGE_WIDTH, QString::number (img.width()));
811 writer.writeAttribute(DOCUMENT_SERIALIZE_IMAGE_HEIGHT, QString::number (img.height()));
813 writer.writeCDATA (array.toBase64 ());
814 writer.writeEndElement();
816 m_coordSystemContext.
saveXml (writer);
826 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setCoordSystemIndex";
833 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setCurveAxes";
840 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setCurvesGraphs";
847 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setDocumentAxesPointsRequired";
854 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setModelAxesChecker";
861 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setModelColorFilter";
864 ColorFilterSettingsList::const_iterator itr;
869 QString curveName = itr.key();
879 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setModelCoords";
886 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setModelCurveStyles";
889 QStringList curveNames = modelCurveStyles.
curveNames();
890 QStringList::iterator itr;
891 for (itr = curveNames.begin(); itr != curveNames.end(); itr++) {
893 QString curveName = *itr;
903 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setModelDigitizeCurve";
910 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setModelExport";
917 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setModelGeneral";
924 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setModelGridDisplay";
931 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setModelGridRemoval";
938 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setModelPointMatch";
945 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setModelSegments";
957 return m_successfulRead;
962 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::updatePointOrdinals";
967 int Document::versionFromFile (QFile *file)
const
969 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::versionFromFile";
971 int version = VERSION_6;
974 if (doc.setContent (file)) {
976 QDomNodeList nodes = doc.elementsByTagName (DOCUMENT_SERIALIZE_DOCUMENT);
977 if (nodes.count() > 0) {
978 QDomNode node = nodes.at (0);
980 QDomNamedNodeMap attributes = node.attributes();
982 if (attributes.contains (DOCUMENT_SERIALIZE_APPLICATION_VERSION_NUMBER)) {
984 QDomElement elem = node.toElement();
985 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 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 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 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.