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 "CurveStyle.h"
16 #include "CurveStyles.h"
18 #include "DocumentSerialize.h"
19 #include "EngaugeAssert.h"
20 #include "EnumsToQt.h"
21 #include "GridInitializer.h"
24 #include "OrdinalGenerator.h"
26 #include "PointStyle.h"
28 #include <QDataStream>
30 #include <QDomDocument>
35 #include <QtToString.h>
36 #include <QXmlStreamReader>
37 #include <QXmlStreamWriter>
38 #include "SettingsForGraph.h"
39 #include "Transformation.h"
43 const int FOUR_BYTES = 4;
44 const int NOMINAL_COORD_SYSTEM_COUNT = 1;
45 const int VERSION_6 = 6;
46 const int VERSION_7 = 7;
47 const int VERSION_8 = 8;
48 const int VERSION_9 = 9;
49 const int VERSION_10 = 10;
53 m_documentAxesPointsRequired (DOCUMENT_AXES_POINTS_REQUIRED_3)
55 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::Document"
56 <<
" image=" << image.width() <<
"x" << image.height();
60 m_successfulRead =
true;
62 m_pixmap.convertFromImage (image);
67 m_documentAxesPointsRequired (DOCUMENT_AXES_POINTS_REQUIRED_3)
69 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::Document"
70 <<
" fileName=" << fileName.toLatin1().data();
72 m_successfulRead =
true;
75 QFile *file =
new QFile (fileName);
76 if (file->open(QIODevice::ReadOnly)) {
78 QByteArray bytesStart = file->read (FOUR_BYTES);
81 if (bytesIndicatePreVersion6 (bytesStart)) {
83 QFile *file =
new QFile (fileName);
84 if (file->open (QIODevice::ReadOnly)) {
85 QDataStream str (file);
88 loadPreVersion6 (str);
92 m_successfulRead =
false;
93 m_reasonForUnsuccessfulRead = QObject::tr (
"Operating system says file is not readable");
98 QFile *file =
new QFile (fileName);
99 if (file->open (QIODevice::ReadOnly | QIODevice::Text)) {
101 int version = versionFromFile (file);
112 loadVersions7AndUp (file);
116 m_successfulRead =
false;
117 m_reasonForUnsuccessfulRead = QString (
"Engauge %1 %2 %3 %4 Engauge")
118 .arg (VERSION_NUMBER)
119 .arg (QObject::tr (
"cannot read newer files from version"))
121 .arg (QObject::tr (
"of"));
132 m_successfulRead =
false;
133 m_reasonForUnsuccessfulRead = QObject::tr (
"Operating system says file is not readable");
138 m_successfulRead =
false;
139 m_reasonForUnsuccessfulRead = QString (
"%1 '%2' %3")
140 .arg (QObject::tr (
"File"))
142 .arg (QObject::tr (
"was not found"));
148 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::addCoordSystems"
149 <<
" toAdd=" << 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";
225 const QPointF &posScreen1,
227 QString &identifier0,
228 QString &identifier1,
232 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::addScaleWithGeneratedIdentifier";
234 const bool IS_X_ONLY =
false;
242 QPointF (scaleLength, 0),
248 bool Document::bytesIndicatePreVersion6 (
const QByteArray &bytes)
const
250 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::bytesIndicatePreVersion6";
252 QByteArray preVersion6MagicNumber;
253 preVersion6MagicNumber.resize (FOUR_BYTES);
256 preVersion6MagicNumber[0] =
'\x00';
257 preVersion6MagicNumber[1] =
'\x00';
258 preVersion6MagicNumber[2] =
'\xCA';
259 preVersion6MagicNumber[3] =
'\xFE';
261 return (bytes == preVersion6MagicNumber);
265 const QPointF &posGraph,
267 QString &errorMessage,
270 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::checkAddPointAxis";
277 m_documentAxesPointsRequired);
281 const QPointF &posScreen,
282 const QPointF &posGraph,
284 QString &errorMessage)
286 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::checkEditPointAxis";
293 m_documentAxesPointsRequired);
298 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::coordSystem";
305 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::coordSystemCount";
312 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::coordSystemIndex";
319 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::curveAxes";
326 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::curveForCurveName";
333 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::curveForCurveName";
340 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::curvesGraphs";
347 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::curvesGraphsNames";
354 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::curvesGraphsNumPoints";
361 return m_documentAxesPointsRequired;
365 const QString &identifier)
367 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::editPointAxis";
377 const QStringList &identifiers,
380 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::editPointCurve";
390 void Document::generateEmptyPixmap(
const QXmlStreamAttributes &attributes)
392 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::generateEmptyPixmap";
394 int width = 800, height = 500;
396 if (attributes.hasAttribute (DOCUMENT_SERIALIZE_IMAGE_WIDTH) &&
397 attributes.hasAttribute (DOCUMENT_SERIALIZE_IMAGE_HEIGHT)) {
399 width = attributes.value (DOCUMENT_SERIALIZE_IMAGE_WIDTH).toInt();
400 height = attributes.value (DOCUMENT_SERIALIZE_IMAGE_HEIGHT).toInt();
404 m_pixmap = QPixmap (width, height);
409 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::initializeGridDisplay";
417 Functor2wRet<const QString &, const Point &, CallbackSearchReturn> ftorWithCallback = functor_ret (ftor,
424 QPointF boundingRectGraphMin = ftor.boundingRectGraphMin (isEmpty);
425 QPointF boundingRectGraphMax = ftor.boundingRectGraphMax (isEmpty);
431 boundingRectGraphMax,
442 return m_coordSystemContext.
isXOnly (pointIdentifier);
447 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::iterateThroughCurvePointsAxes";
454 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::iterateThroughCurvePointsAxes";
460 const Functor2wRet<const Point &, const Point &, CallbackSearchReturn> &ftorWithCallback)
const
462 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::iterateThroughCurveSegments";
470 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::iterateThroughCurvesPointsGraphs";
477 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::iterateThroughCurvesPointsGraphs";
482 void Document::loadImage(QXmlStreamReader &reader)
484 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::loadImage";
486 loadNextFromReader(reader);
487 if (reader.isCDATA ()) {
490 QByteArray array64 = reader.text().toString().toUtf8();
494 array = QByteArray::fromBase64(array64);
497 QDataStream str (&array, QIODevice::ReadOnly);
498 QImage img = m_pixmap.toImage ();
500 m_pixmap = QPixmap::fromImage (img);
503 while ((reader.tokenType() != QXmlStreamReader::EndElement) ||
504 (reader.name() != DOCUMENT_SERIALIZE_IMAGE)){
505 loadNextFromReader(reader);
513 reader.raiseError (QObject::tr (
"Cannot read image data"));
517 void Document::loadPreVersion6 (QDataStream &str)
519 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::loadPreVersion6";
534 m_documentAxesPointsRequired);
537 void Document::loadVersion6 (QFile *file)
539 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::loadVersion6";
541 QXmlStreamReader reader (file);
543 m_documentAxesPointsRequired = DOCUMENT_AXES_POINTS_REQUIRED_3;
550 bool inDocumentSubtree =
false;
553 while (!reader.atEnd() &&
554 !reader.hasError()) {
555 QXmlStreamReader::TokenType tokenType = loadNextFromReader(reader);
558 if ((reader.name() == DOCUMENT_SERIALIZE_IMAGE) &&
559 (tokenType == QXmlStreamReader::StartElement)) {
561 generateEmptyPixmap (reader.attributes());
565 if ((reader.name() == DOCUMENT_SERIALIZE_DOCUMENT) &&
566 (tokenType == QXmlStreamReader::StartElement)) {
568 inDocumentSubtree =
true;
570 }
else if ((reader.name() == DOCUMENT_SERIALIZE_DOCUMENT) &&
571 (tokenType == QXmlStreamReader::EndElement)) {
577 if (inDocumentSubtree) {
580 if (tokenType == QXmlStreamReader::StartElement) {
583 QString tag = reader.name().toString();
584 if (tag == DOCUMENT_SERIALIZE_IMAGE) {
590 m_documentAxesPointsRequired);
598 if (reader.hasError ()) {
600 m_successfulRead =
false;
601 m_reasonForUnsuccessfulRead = reader.errorString();
607 void Document::loadVersions7AndUp (QFile *file)
609 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::loadVersions7AndUp";
611 const int ONE_COORDINATE_SYSTEM = 1;
613 QXmlStreamReader reader (file);
617 bool inDocumentSubtree =
false;
620 while (!reader.atEnd() &&
621 !reader.hasError()) {
622 QXmlStreamReader::TokenType tokenType = loadNextFromReader(reader);
625 if ((reader.name() == DOCUMENT_SERIALIZE_IMAGE) &&
626 (tokenType == QXmlStreamReader::StartElement)) {
628 generateEmptyPixmap (reader.attributes());
632 if ((reader.name() == DOCUMENT_SERIALIZE_DOCUMENT) &&
633 (tokenType == QXmlStreamReader::StartElement)) {
635 inDocumentSubtree =
true;
637 QXmlStreamAttributes attributes = reader.attributes();
638 if (attributes.hasAttribute (DOCUMENT_SERIALIZE_AXES_POINTS_REQUIRED)) {
639 m_documentAxesPointsRequired = (DocumentAxesPointsRequired) attributes.value (DOCUMENT_SERIALIZE_AXES_POINTS_REQUIRED).toInt();
641 m_documentAxesPointsRequired = DOCUMENT_AXES_POINTS_REQUIRED_3;
644 }
else if ((reader.name() == DOCUMENT_SERIALIZE_DOCUMENT) &&
645 (tokenType == QXmlStreamReader::EndElement)) {
651 if (inDocumentSubtree) {
654 if (tokenType == QXmlStreamReader::StartElement) {
657 QString tag = reader.name().toString();
658 if (tag == DOCUMENT_SERIALIZE_COORD_SYSTEM) {
661 }
else if (tag == DOCUMENT_SERIALIZE_IMAGE) {
668 if (reader.hasError ()) {
670 m_successfulRead =
false;
671 m_reasonForUnsuccessfulRead = reader.errorString();
679 LOG4CPP_DEBUG_S ((*mainCat)) <<
"Document::modelAxesChecker";
686 LOG4CPP_DEBUG_S ((*mainCat)) <<
"Document::modelColorFilter";
693 LOG4CPP_DEBUG_S ((*mainCat)) <<
"Document::modelCoords";
700 LOG4CPP_DEBUG_S ((*mainCat)) <<
"Document::modelCurveStyles";
707 LOG4CPP_DEBUG_S ((*mainCat)) <<
"Document::modelDigitizeCurve";
714 LOG4CPP_DEBUG_S ((*mainCat)) <<
"Document::modelExport";
721 LOG4CPP_DEBUG_S ((*mainCat)) <<
"Document::modelGeneral";
728 LOG4CPP_DEBUG_S ((*mainCat)) <<
"Document::modelGridDisplay";
735 LOG4CPP_DEBUG_S ((*mainCat)) <<
"Document::modelGridRemoval";
742 LOG4CPP_DEBUG_S ((*mainCat)) <<
"Document::modelPointMatch";
749 LOG4CPP_DEBUG_S ((*mainCat)) <<
"Document::modelSegments";
755 const QPointF &deltaScreen)
757 m_coordSystemContext.
movePoint (pointIdentifier,
763 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::nextOrdinalForCurve";
768 void Document::overrideGraphDefaultsWithMapDefaults ()
770 const int DEFAULT_WIDTH = 1;
779 pointStyle.
setShape (POINT_SHAPE_CIRCLE);
795 QStringList::const_iterator itr;
796 for (itr = curveNames.begin(); itr != curveNames.end(); itr++) {
797 QString curveName = *itr;
831 QTextStream str (&text);
835 std::cerr << text.toLatin1().data();
839 QTextStream &str)
const
841 str << indentation <<
"Document\n";
843 indentation += INDENTATION_DELTA;
845 str << indentation <<
"name=" << m_name <<
"\n";
846 str << indentation <<
"pixmap=" << m_pixmap.width() <<
"x" << m_pixmap.height() <<
"\n";
854 ENGAUGE_ASSERT (!m_successfulRead);
856 return m_reasonForUnsuccessfulRead;
861 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::removePointAxis";
868 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::removePointGraph";
875 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::removePointsInCurvesGraphs";
882 writer.writeStartElement(DOCUMENT_SERIALIZE_DOCUMENT);
886 writer.writeAttribute(DOCUMENT_SERIALIZE_APPLICATION_VERSION_NUMBER, VERSION_NUMBER);
889 writer.writeAttribute(DOCUMENT_SERIALIZE_AXES_POINTS_REQUIRED, QString::number (m_documentAxesPointsRequired));
893 QDataStream str (&array, QIODevice::WriteOnly);
894 QImage img = m_pixmap.toImage ();
896 writer.writeStartElement(DOCUMENT_SERIALIZE_IMAGE);
900 writer.writeAttribute(DOCUMENT_SERIALIZE_IMAGE_WIDTH, QString::number (img.width()));
901 writer.writeAttribute(DOCUMENT_SERIALIZE_IMAGE_HEIGHT, QString::number (img.height()));
903 writer.writeCDATA (array.toBase64 ());
904 writer.writeEndElement();
906 m_coordSystemContext.
saveXml (writer);
916 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setCoordSystemIndex";
923 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setCurveAxes";
930 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setCurvesGraphs";
937 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setDocumentAxesPointsRequired";
941 if (documentAxesPointsRequired == DOCUMENT_AXES_POINTS_REQUIRED_2) {
943 overrideGraphDefaultsWithMapDefaults ();
949 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setModelAxesChecker";
956 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setModelColorFilter";
959 ColorFilterSettingsList::const_iterator itr;
964 QString curveName = itr.key();
974 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setModelCoords";
981 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setModelCurveStyles";
984 QStringList curveNames = modelCurveStyles.
curveNames();
985 QStringList::iterator itr;
986 for (itr = curveNames.begin(); itr != curveNames.end(); itr++) {
988 QString curveName = *itr;
998 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setModelDigitizeCurve";
1005 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setModelExport";
1012 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setModelGeneral";
1019 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setModelGridDisplay";
1026 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setModelGridRemoval";
1033 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setModelPointMatch";
1040 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setModelSegments";
1047 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setPixmap";
1049 m_pixmap = QPixmap::fromImage (image);
1059 return m_successfulRead;
1064 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::updatePointOrdinals";
1069 int Document::versionFromFile (QFile *file)
const
1071 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::versionFromFile";
1073 int version = VERSION_6;
1076 if (doc.setContent (file)) {
1078 QDomNodeList nodes = doc.elementsByTagName (DOCUMENT_SERIALIZE_DOCUMENT);
1079 if (nodes.count() > 0) {
1080 QDomNode node = nodes.at (0);
1082 QDomNamedNodeMap attributes = node.attributes();
1084 if (attributes.contains (DOCUMENT_SERIALIZE_APPLICATION_VERSION_NUMBER)) {
1086 QDomElement elem = node.toElement();
1087 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 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.
void addCoordSystems(unsigned int numberCoordSystemToAdd)
Add specified number of coordinate systems to the original one created by the constructor.
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.
DocumentModelGridDisplay initializeWithWidePolarCoverage(const QPointF &boundingRectGraphMin, const QPointF &boundingRectGraphMax, 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...
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 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.
LineStyle lineStyle() const
Get method for LineStyle.
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 void checkAddPointAxis(const QPointF &posScreen, const QPointF &posGraph, bool &isError, QString &errorMessage, bool isXOnly, DocumentAxesPointsRequired documentAxesPointsRequired)
Check before calling addPointAxis. Also returns the next available ordinal number (to prevent clashes...
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.
PointStyle pointStyle() const
Get method for PointStyle.
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 addScaleWithGeneratedIdentifier(const QPointF &posScreen0, const QPointF &posScreen1, double scaleLength, QString &identifier0, QString &identifier1, double ordinal0, double ordinal1)
Add scale with a generated point identifier.
void loadVersions7AndUp(QXmlStreamReader &reader)
Load one CoordSystem from file in version 7 format or newer, into the most recent CoordSystem which w...
void setLineStyle(const LineStyle &lineStyle)
Set method for LineStyle.
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.
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.
void setCurveStyle(const QString &curveName, const CurveStyle &curveStyle)
Set method for curve style.
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.
void setShape(PointShape shape)
Set method for point shape.
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.
Details for a specific Point.
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 checkEditPointAxis(const QString &pointIdentifier, const QPointF &posScreen, const QPointF &posGraph, bool &isError, QString &errorMessage, DocumentAxesPointsRequired documentAxesPointsRequired)
Check before calling editPointAxis.
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.
void setPaletteColor(ColorPalette paletteColor)
Set method for point color.
virtual DocumentModelAxesChecker modelAxesChecker() const
Get method for DocumentModelAxesChecker.
Container for one set of digitized Points.
Details for a specific Line.
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.
void setCurveConnectAs(CurveConnectAs curveConnectAs)
Set connect as.
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...
void loadPreVersion6(QDataStream &str, double version, DocumentAxesPointsRequired &documentAxesPointsRequired)
Load from file in pre-version 6 format.
void loadVersion6(QXmlStreamReader &reader, DocumentAxesPointsRequired &documentAxesPointsRequired)
Load from file in version 6 format, into the single CoordSystem.
virtual DocumentModelSegments modelSegments() const
Get method for DocumentModelSegments.
void setPaletteColor(ColorPalette paletteColor)
Set method for line color.
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.
void setWidth(int width)
Set width of line.
void setPointStyle(const PointStyle &pointStyle)
Set method for PointStyle.
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.