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;
50 const int VERSION_11 = 11;
51 const int VERSION_12 = 12;
55 m_documentAxesPointsRequired (DOCUMENT_AXES_POINTS_REQUIRED_3)
57 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::Document" 58 <<
" image=" << image.width() <<
"x" << image.height();
62 m_successfulRead =
true;
64 m_pixmap.convertFromImage (image);
69 m_documentAxesPointsRequired (DOCUMENT_AXES_POINTS_REQUIRED_3)
71 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::Document" 72 <<
" fileName=" << fileName.toLatin1().data();
74 m_successfulRead =
true;
77 QFile fileVersion (fileName);
78 if (fileVersion.open(QIODevice::ReadOnly)) {
80 QByteArray bytesStart = fileVersion.read (FOUR_BYTES);
83 if (bytesIndicatePreVersion6 (bytesStart)) {
85 QFile *file =
new QFile (fileName);
86 if (file->open (QIODevice::ReadOnly)) {
87 QDataStream str (file);
90 loadPreVersion6 (str);
94 m_successfulRead =
false;
95 m_reasonForUnsuccessfulRead = QObject::tr (
"Operating system says file is not readable");
100 QFile *file =
new QFile (fileName);
101 if (file->open (QIODevice::ReadOnly | QIODevice::Text)) {
103 int version = versionFromFile (file);
116 loadVersions7AndUp (file);
120 m_successfulRead =
false;
121 m_reasonForUnsuccessfulRead = QString (
"Engauge %1 %2 %3 %4 Engauge")
122 .arg (VERSION_NUMBER)
123 .arg (QObject::tr (
"cannot read newer files from version"))
125 .arg (QObject::tr (
"of"));
136 m_successfulRead =
false;
137 m_reasonForUnsuccessfulRead = QObject::tr (
"Operating system says file is not readable");
141 fileVersion.close ();
142 m_successfulRead =
false;
143 m_reasonForUnsuccessfulRead = QString (
"%1 '%2' %3")
144 .arg (QObject::tr (
"File"))
146 .arg (QObject::tr (
"was not found"));
152 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::addCoordSystems" 153 <<
" toAdd=" << numberCoordSystemToAdd;
160 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::addGraphCurveAtEnd";
166 const QPointF &posGraph,
171 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::addPointAxisWithGeneratedIdentifier";
181 const QPointF &posGraph,
182 const QString &identifier,
186 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::addPointAxisWithSpecifiedIdentifier";
196 const QPointF &posScreen,
200 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::addPointGraphWithGeneratedIdentifier";
209 const QPointF &posScreen,
210 const QString &identifier,
213 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::addPointGraphWithSpecifiedIdentifier";
223 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::addPointsInCurvesGraphs";
229 const QPointF &posScreen1,
231 QString &identifier0,
232 QString &identifier1,
236 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::addScaleWithGeneratedIdentifier";
238 const bool IS_X_ONLY =
false;
246 QPointF (scaleLength, 0),
252 bool Document::bytesIndicatePreVersion6 (
const QByteArray &bytes)
const 254 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::bytesIndicatePreVersion6";
256 QByteArray preVersion6MagicNumber;
257 preVersion6MagicNumber.resize (FOUR_BYTES);
260 preVersion6MagicNumber[0] =
'\x00';
261 preVersion6MagicNumber[1] =
'\x00';
262 preVersion6MagicNumber[2] =
'\xCA';
263 preVersion6MagicNumber[3] =
'\xFE';
265 return (bytes == preVersion6MagicNumber);
269 const QPointF &posGraph,
271 QString &errorMessage,
274 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::checkAddPointAxis";
281 m_documentAxesPointsRequired);
285 const QPointF &posScreen,
286 const QPointF &posGraph,
288 QString &errorMessage)
290 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::checkEditPointAxis";
297 m_documentAxesPointsRequired);
302 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::coordSystem";
309 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::coordSystemCount";
316 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::coordSystemIndex";
323 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::curveAxes";
330 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::curveForCurveName";
337 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::curveForCurveName";
344 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::curvesGraphs";
351 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::curvesGraphsNames";
358 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::curvesGraphsNumPoints";
365 return m_documentAxesPointsRequired;
369 const QString &identifier)
371 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::editPointAxis";
381 const QStringList &identifiers,
384 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::editPointCurve";
394 void Document::generateEmptyPixmap(
const QXmlStreamAttributes &attributes)
396 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::generateEmptyPixmap";
398 int width = 800, height = 500;
400 if (attributes.hasAttribute (DOCUMENT_SERIALIZE_IMAGE_WIDTH) &&
401 attributes.hasAttribute (DOCUMENT_SERIALIZE_IMAGE_HEIGHT)) {
403 width = attributes.value (DOCUMENT_SERIALIZE_IMAGE_WIDTH).toInt();
404 height = attributes.value (DOCUMENT_SERIALIZE_IMAGE_HEIGHT).toInt();
408 m_pixmap = QPixmap (width, height);
413 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::initializeGridDisplay";
421 Functor2wRet<const QString &, const Point &, CallbackSearchReturn> ftorWithCallback = functor_ret (ftor,
428 QPointF boundingRectGraphMin = ftor.boundingRectGraphMin (isEmpty);
429 QPointF boundingRectGraphMax = ftor.boundingRectGraphMax (isEmpty);
435 boundingRectGraphMax,
446 return m_coordSystemContext.
isXOnly (pointIdentifier);
451 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::iterateThroughCurvePointsAxes";
458 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::iterateThroughCurvePointsAxes";
464 const Functor2wRet<const Point &, const Point &, CallbackSearchReturn> &ftorWithCallback)
const 466 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::iterateThroughCurveSegments";
474 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::iterateThroughCurvesPointsGraphs";
481 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::iterateThroughCurvesPointsGraphs";
486 void Document::loadImage(QXmlStreamReader &reader)
488 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::loadImage";
490 loadNextFromReader(reader);
491 if (reader.isCDATA ()) {
494 QByteArray array64 = reader.text().toString().toUtf8();
498 array = QByteArray::fromBase64(array64);
501 QDataStream str (&array, QIODevice::ReadOnly);
502 QImage img = m_pixmap.toImage ();
504 m_pixmap = QPixmap::fromImage (img);
507 while ((reader.tokenType() != QXmlStreamReader::EndElement) ||
508 (reader.name() != DOCUMENT_SERIALIZE_IMAGE)){
509 loadNextFromReader(reader);
517 reader.raiseError (QObject::tr (
"Cannot read image data"));
521 void Document::loadPreVersion6 (QDataStream &str)
523 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::loadPreVersion6";
538 m_documentAxesPointsRequired);
541 void Document::loadVersion6 (QFile *file)
543 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::loadVersion6";
545 QXmlStreamReader reader (file);
547 m_documentAxesPointsRequired = DOCUMENT_AXES_POINTS_REQUIRED_3;
554 bool inDocumentSubtree =
false;
557 while (!reader.atEnd() &&
558 !reader.hasError()) {
559 QXmlStreamReader::TokenType tokenType = loadNextFromReader(reader);
562 if ((reader.name() == DOCUMENT_SERIALIZE_IMAGE) &&
563 (tokenType == QXmlStreamReader::StartElement)) {
565 generateEmptyPixmap (reader.attributes());
569 if ((reader.name() == DOCUMENT_SERIALIZE_DOCUMENT) &&
570 (tokenType == QXmlStreamReader::StartElement)) {
572 inDocumentSubtree =
true;
574 }
else if ((reader.name() == DOCUMENT_SERIALIZE_DOCUMENT) &&
575 (tokenType == QXmlStreamReader::EndElement)) {
581 if (inDocumentSubtree) {
584 if (tokenType == QXmlStreamReader::StartElement) {
587 QString tag = reader.name().toString();
588 if (tag == DOCUMENT_SERIALIZE_IMAGE) {
594 m_documentAxesPointsRequired);
602 if (reader.hasError ()) {
604 m_successfulRead =
false;
605 m_reasonForUnsuccessfulRead = reader.errorString();
611 void Document::loadVersions7AndUp (QFile *file)
613 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::loadVersions7AndUp";
615 const int ONE_COORDINATE_SYSTEM = 1;
617 QXmlStreamReader reader (file);
621 bool inDocumentSubtree =
false;
624 while (!reader.atEnd() &&
625 !reader.hasError()) {
626 QXmlStreamReader::TokenType tokenType = loadNextFromReader(reader);
629 if ((reader.name() == DOCUMENT_SERIALIZE_IMAGE) &&
630 (tokenType == QXmlStreamReader::StartElement)) {
632 generateEmptyPixmap (reader.attributes());
636 if ((reader.name() == DOCUMENT_SERIALIZE_DOCUMENT) &&
637 (tokenType == QXmlStreamReader::StartElement)) {
639 inDocumentSubtree =
true;
641 QXmlStreamAttributes attributes = reader.attributes();
642 if (attributes.hasAttribute (DOCUMENT_SERIALIZE_AXES_POINTS_REQUIRED)) {
643 m_documentAxesPointsRequired = static_cast<DocumentAxesPointsRequired> (attributes.value (DOCUMENT_SERIALIZE_AXES_POINTS_REQUIRED).toInt());
645 m_documentAxesPointsRequired = DOCUMENT_AXES_POINTS_REQUIRED_3;
648 }
else if ((reader.name() == DOCUMENT_SERIALIZE_DOCUMENT) &&
649 (tokenType == QXmlStreamReader::EndElement)) {
655 if (inDocumentSubtree) {
658 if (tokenType == QXmlStreamReader::StartElement) {
661 QString tag = reader.name().toString();
662 if (tag == DOCUMENT_SERIALIZE_COORD_SYSTEM) {
665 }
else if (tag == DOCUMENT_SERIALIZE_IMAGE) {
672 if (reader.hasError ()) {
674 m_successfulRead =
false;
675 m_reasonForUnsuccessfulRead = reader.errorString();
683 LOG4CPP_DEBUG_S ((*mainCat)) <<
"Document::modelAxesChecker";
690 LOG4CPP_DEBUG_S ((*mainCat)) <<
"Document::modelColorFilter";
697 LOG4CPP_DEBUG_S ((*mainCat)) <<
"Document::modelCoords";
704 LOG4CPP_DEBUG_S ((*mainCat)) <<
"Document::modelCurveStyles";
711 LOG4CPP_DEBUG_S ((*mainCat)) <<
"Document::modelDigitizeCurve";
718 LOG4CPP_DEBUG_S ((*mainCat)) <<
"Document::modelExport";
725 LOG4CPP_DEBUG_S ((*mainCat)) <<
"Document::modelGeneral";
732 LOG4CPP_DEBUG_S ((*mainCat)) <<
"Document::modelGridDisplay";
739 LOG4CPP_DEBUG_S ((*mainCat)) <<
"Document::modelGridRemoval";
746 LOG4CPP_DEBUG_S ((*mainCat)) <<
"Document::modelPointMatch";
753 LOG4CPP_DEBUG_S ((*mainCat)) <<
"Document::modelSegments";
759 const QPointF &deltaScreen)
761 m_coordSystemContext.
movePoint (pointIdentifier,
767 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::nextOrdinalForCurve";
772 void Document::overrideGraphDefaultsWithMapDefaults ()
774 const int DEFAULT_WIDTH = 1;
783 pointStyle.
setShape (POINT_SHAPE_CIRCLE);
799 QStringList::const_iterator itr;
800 for (itr = curveNames.begin(); itr != curveNames.end(); itr++) {
801 QString curveName = *itr;
835 QTextStream str (&text);
839 std::cerr << text.toLatin1().data();
843 QTextStream &str)
const 845 str << indentation <<
"Document\n";
847 indentation += INDENTATION_DELTA;
849 str << indentation <<
"name=" << m_name <<
"\n";
850 str << indentation <<
"pixmap=" << m_pixmap.width() <<
"x" << m_pixmap.height() <<
"\n";
858 ENGAUGE_ASSERT (!m_successfulRead);
860 return m_reasonForUnsuccessfulRead;
865 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::removePointAxis";
872 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::removePointGraph";
879 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::removePointsInCurvesGraphs";
886 writer.writeStartElement(DOCUMENT_SERIALIZE_DOCUMENT);
890 writer.writeAttribute(DOCUMENT_SERIALIZE_APPLICATION_VERSION_NUMBER, VERSION_NUMBER);
893 writer.writeAttribute(DOCUMENT_SERIALIZE_AXES_POINTS_REQUIRED, QString::number (m_documentAxesPointsRequired));
897 QDataStream str (&array, QIODevice::WriteOnly);
898 QImage img = m_pixmap.toImage ();
900 writer.writeStartElement(DOCUMENT_SERIALIZE_IMAGE);
904 writer.writeAttribute(DOCUMENT_SERIALIZE_IMAGE_WIDTH, QString::number (img.width()));
905 writer.writeAttribute(DOCUMENT_SERIALIZE_IMAGE_HEIGHT, QString::number (img.height()));
907 writer.writeCDATA (array.toBase64 ());
908 writer.writeEndElement();
910 m_coordSystemContext.
saveXml (writer);
920 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setCoordSystemIndex";
927 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setCurveAxes";
934 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setCurvesGraphs";
941 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setDocumentAxesPointsRequired";
947 overrideGraphDefaultsWithMapDefaults ();
953 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setModelAxesChecker";
960 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setModelColorFilter";
963 ColorFilterSettingsList::const_iterator itr;
968 QString curveName = itr.key();
978 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setModelCoords";
985 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setModelCurveStyles";
989 QStringList::iterator itr;
990 for (itr = curveNames.begin(); itr != curveNames.end(); itr++) {
992 QString curveName = *itr;
1002 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setModelDigitizeCurve";
1009 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setModelExport";
1016 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setModelGeneral";
1023 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setModelGridDisplay";
1030 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setModelGridRemoval";
1037 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setModelPointMatch";
1044 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setModelSegments";
1051 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setPixmap";
1053 m_pixmap = QPixmap::fromImage (image);
1063 return m_successfulRead;
1068 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::updatePointOrdinals";
1073 int Document::versionFromFile (QFile *file)
const 1075 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::versionFromFile";
1077 int version = VERSION_6;
1080 if (doc.setContent (file)) {
1082 QDomNodeList nodes = doc.elementsByTagName (DOCUMENT_SERIALIZE_DOCUMENT);
1083 if (nodes.count() > 0) {
1084 QDomNode node = nodes.at (0);
1086 QDomNamedNodeMap attributes = node.attributes();
1088 if (attributes.contains (DOCUMENT_SERIALIZE_APPLICATION_VERSION_NUMBER)) {
1090 QDomElement elem = node.toElement();
1091 version = qFloor (elem.attribute (DOCUMENT_SERIALIZE_APPLICATION_VERSION_NUMBER).toDouble());
void addCoordSystems(unsigned int numberCoordSystemToAdd)
Add some number (0 or more) of additional coordinate systems.
void addGraphCurveAtEnd(const QString &curveName)
Add new graph curve to the list of existing graph curves.
const ColorFilterSettingsList & colorFilterSettingsList() const
Get method for copying all color filters in one step.
Model for DlgSettingsGeneral and CmdSettingsGeneral.
CurveStyle curveStyle(const QString &curveName) const
CurveStyle in specified curve.
void addCoordSystems(unsigned int numberCoordSystemToAdd)
Add specified number of coordinate systems to the original one created by the constructor.
CallbackSearchReturn callback(const QString &curveName, const Point &point)
Callback method.
int curvesGraphsNumPoints(const QString &curveName) const
See CurvesGraphs::curvesGraphsNumPoints.
void movePoint(const QString &pointIdentifier, const QPointF &deltaScreen)
See Curve::movePoint.
const CoordSystem & coordSystem() const
Currently active CoordSystem.
virtual int curvesGraphsNumPoints(const QString &curveName) const
See CurvesGraphs::curvesGraphsNumPoints.
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.
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.
virtual DocumentModelDigitizeCurve modelDigitizeCurve() const
Get method for DocumentModelDigitizeCurve.
void addPointGraphWithGeneratedIdentifier(const QString &curveName, const QPointF &posScreen, QString &generatedIentifier, double ordinal)
Add a single graph point with a generated point identifier.
virtual DocumentModelGridDisplay modelGridDisplay() const
Get method for DocumentModelGridDisplay.
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.
QStringList curveNames() const
List of all curve names.
Model for DlgSettingsCurveProperties and CmdSettingsCurveProperties.
DocumentModelGridRemoval modelGridRemoval() const
Get method for DocumentModelGridRemoval.
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.
virtual void saveXml(QXmlStreamWriter &writer) const
Save graph to xml.
virtual DocumentModelGeneral modelGeneral() const
Get method for DocumentModelGeneral.
int nextOrdinalForCurve(const QString &curveName) const
Default next ordinal value for specified curve.
void setColorFilterSettings(const ColorFilterSettings &colorFilterSettings)
Set color filter.
bool successfulRead() const
Return true if startup loading succeeded. If the loading failed then reasonForUnsuccessfulRed will ex...
virtual void addPointGraphWithSpecifiedIdentifier(const QString &curveName, const QPointF &posScreen, const QString &identifier, double ordinal)
Add a single graph point with the specified point identifer. Note that PointStyle is not applied to t...
virtual DocumentModelColorFilter modelColorFilter() const
Get method for DocumentModelColorFilter.
Storage of data belonging to one coordinate system.
PointStyle pointStyle() const
Get method for PointStyle.
virtual DocumentModelPointMatch modelPointMatch() const
Get method for DocumentModelPointMatch.
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...
void iterateThroughCurvePointsAxes(const Functor2wRet< const QString &, const Point &, CallbackSearchReturn > &ftorWithCallback)
See Curve::iterateThroughCurvePoints, for the axes curve.
const Curve * curveForCurveName(const QString &curveName) const
See CurvesGraphs::curveForCurveNames, although this also works for AXIS_CURVE_NAME.
DocumentModelGeneral modelGeneral() const
Get method for DocumentModelGeneral.
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...
DocumentAxesPointsRequired documentAxesPointsRequired() const
Get method for DocumentAxesPointsRequired.
virtual Curve * curveForCurveName(const QString &curveName)
See CurvesGraphs::curveForCurveName, although this also works for AXIS_CURVE_NAME.
DocumentModelColorFilter modelColorFilter() const
Get method for DocumentModelColorFilter.
virtual DocumentModelAxesChecker modelAxesChecker() const
Get method for DocumentModelAxesChecker.
void setModelDigitizeCurve(const DocumentModelDigitizeCurve &modelDigitizeCurve)
Set method for DocumentModelDigitizeCurve.
unsigned int coordSystemCount() const
Number of 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.
bool stable() const
Get method for stable flag.
DocumentModelPointMatch modelPointMatch() const
Get method for DocumentModelPointMatch.
virtual void setModelCoords(const DocumentModelCoords &modelCoords)
Set method for DocumentModelCoords.
CoordSystemIndex coordSystemIndex() const
Index of current CoordSystem.
void checkAddPointAxis(const QPointF &posScreen, const QPointF &posGraph, bool &isError, QString &errorMessage, bool isXOnly)
Check before calling addPointAxis. Also returns the next available ordinal number (to prevent clashes...
void setPixmap(const QImage &image)
Set method for the background pixmap.
virtual CurveStyles modelCurveStyles() const
Get method for CurveStyles.
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 int nextOrdinalForCurve(const QString &curveName) const
Default next ordinal value for specified curve.
virtual void setCurvesGraphs(const CurvesGraphs &curvesGraphs)
Let CmdAbstract classes overwrite CurvesGraphs. Applies to current coordinate system.
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 setModelGridRemoval(const DocumentModelGridRemoval &modelGridRemoval)
Set method for DocumentModelGridRemoval.
void setModelExport(const DocumentModelExportFormat &modelExport)
Set method for DocumentModelExportFormat.
DocumentModelDigitizeCurve modelDigitizeCurve() const
Get method for DocumentModelDigitizeCurve.
void setShape(PointShape shape)
Set method for point shape.
Model for DlgSettingsDigitizeCurve and CmdSettingsDigitizeCurve.
bool isXOnly(const QString &pointIdentifier) const
True/false if y/x value is empty.
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.
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.
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.
CoordSystemIndex coordSystemIndex() const
Index of current active CoordSystem.
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 ...
LineStyle lineStyle() const
Get method for LineStyle.
virtual void setModelDigitizeCurve(const DocumentModelDigitizeCurve &modelDigitizeCurve)
Set method for DocumentModelDigitizeCurve.
DocumentModelSegments modelSegments() const
Get method for DocumentModelSegments.
QPointF positionScreen(const QString &pointIdentifier) const
See Curve::positionScreen.
virtual void removePointGraph(const QString &identifier)
Perform the opposite of addPointGraph.
DocumentModelGridDisplay modelGridDisplay() const
Get method for DocumentModelGridDisplay.
virtual void setModelSegments(const DocumentModelSegments &modelSegments)
Set method for DocumentModelSegments.
void setModelColorFilter(const DocumentModelColorFilter &modelColorFilter)
Set method for DocumentModelColorFilter.
virtual DocumentModelSegments modelSegments() const
Get method for DocumentModelSegments.
Model for DlgSettingsCoords and CmdSettingsCoords.
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.
Container for one set of digitized Points.
Details for a specific Line.
void printStream(QString indentation, QTextStream &str) const
Debugging method that supports print method of this class and printStream method of some other class(...
virtual const Curve & curveAxes() const
Get method for axis 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(...
virtual const CurvesGraphs & curvesGraphs() const
Make all Curves available, read only, for CmdAbstract classes only.
QString reasonForUnsuccessfulRead() const
Return an informative text message explaining why startup loading failed. Applies if successfulRead r...
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.
unsigned int coordSystemCount() const
Number of CoordSystem.
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.
void setDocumentAxesPointsRequired(DocumentAxesPointsRequired documentAxesPointsRequired)
Set the number of axes points required.
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...
virtual void iterateThroughCurvePointsAxes(const Functor2wRet< const QString &, const Point &, CallbackSearchReturn > &ftorWithCallback)
See Curve::iterateThroughCurvePoints, for the axes curve.
void setCurveConnectAs(CurveConnectAs curveConnectAs)
Set connect as.
Model for DlgSettingsSegments and CmdSettingsSegments.
virtual DocumentModelCoords modelCoords() const
Get method for DocumentModelCoords.
virtual QPointF positionGraph(const QString &pointIdentifier) const
See Curve::positionGraph.
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 DocumentModelGridRemoval modelGridRemoval() const
Get method for DocumentModelGridRemoval.
virtual void iterateThroughCurveSegments(const QString &curveName, const Functor2wRet< const Point &, const Point &, CallbackSearchReturn > &ftorWithCallback) const
See Curve::iterateThroughCurveSegments, for any axes or graph curve.
DocumentModelExportFormat modelExport() const
Get method for DocumentModelExportFormat.
virtual void updatePointOrdinals(const Transformation &transformation)
Update point ordinals after point addition/removal or dragging.
void saveXml(QXmlStreamWriter &writer) const
Save document to xml.
QPixmap pixmap() const
Return the image that is being digitized.
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.
void iterateThroughCurveSegments(const QString &curveName, const Functor2wRet< const Point &, const Point &, CallbackSearchReturn > &ftorWithCallback) const
See Curve::iterateThroughCurveSegments, for any axes or graph curve.
void setPaletteColor(ColorPalette paletteColor)
Set method for line color.
QPointF positionGraph(const QString &pointIdentifier) const
See Curve::positionGraph.
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.
CurveStyles modelCurveStyles() const
Get method for CurveStyles.
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.
void print() const
Debugging method for printing directly from symbolic debugger.
void setWidth(int width)
Set width of line.
void setPointStyle(const PointStyle &pointStyle)
Set method for PointStyle.
const CoordSystem & coordSystem() const
Current CoordSystem.
const CurvesGraphs & curvesGraphs() const
Make all Curves available, read only, for CmdAbstract classes only.
Model for DlgSettingsGridRemoval and CmdSettingsGridRemoval. The settings are unstable until the user...
const Curve & curveAxes() const
Get method for axis curve.
Callback for computing the bounding rectangles of the screen and graph coordinates of the points in t...
virtual DocumentModelExportFormat modelExport() const
Get method for DocumentModelExportFormat.
DocumentModelCoords modelCoords() const
Get method for DocumentModelCoords.
QStringList curvesGraphsNames() const
See CurvesGraphs::curvesGraphsNames.
virtual QStringList curvesGraphsNames() const
See CurvesGraphs::curvesGraphsNames.
void updatePointOrdinals(const Transformation &transformation)
Update point ordinals after point addition/removal or dragging.
QString selectedCurveName() const
Currently selected curve name. This is used to set the selected curve combobox in MainWindow.
bool isXOnly(const QString &pointIdentifier) const
See Curve::isXOnly.
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 ...
DocumentModelAxesChecker modelAxesChecker() const
Get method for DocumentModelAxesChecker.
virtual void iterateThroughCurvesPointsGraphs(const Functor2wRet< const QString &, const Point &, CallbackSearchReturn > &ftorWithCallback)
See Curve::iterateThroughCurvePoints, for all the graphs curves.
virtual QString selectedCurveName() const
Currently selected curve name. This is used to set the selected curve combobox in MainWindow.
virtual QPointF positionScreen(const QString &pointIdentifier) const
See Curve::positionScreen.