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();
59 NOMINAL_COORD_SYSTEM_COUNT);
61 m_successfulRead =
true;
63 m_pixmap.convertFromImage (image);
68 m_documentAxesPointsRequired (DOCUMENT_AXES_POINTS_REQUIRED_3)
70 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::Document" 71 <<
" fileName=" << fileName.toLatin1().data();
73 m_successfulRead =
true;
76 QFile *file =
new QFile (fileName);
77 if (file->open(QIODevice::ReadOnly)) {
79 QByteArray bytesStart = file->read (FOUR_BYTES);
82 if (bytesIndicatePreVersion6 (bytesStart)) {
84 QFile *file =
new QFile (fileName);
85 if (file->open (QIODevice::ReadOnly)) {
86 QDataStream str (file);
89 NOMINAL_COORD_SYSTEM_COUNT);
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);
114 loadVersions7AndUp (file);
118 m_successfulRead =
false;
119 m_reasonForUnsuccessfulRead = QString (
"Engauge %1 %2 %3 %4 Engauge")
120 .arg (VERSION_NUMBER)
121 .arg (QObject::tr (
"cannot read newer files from version"))
123 .arg (QObject::tr (
"of"));
134 m_successfulRead =
false;
135 m_reasonForUnsuccessfulRead = QObject::tr (
"Operating system says file is not readable");
140 m_successfulRead =
false;
141 m_reasonForUnsuccessfulRead = QString (
"%1 '%2' %3")
142 .arg (QObject::tr (
"File"))
144 .arg (QObject::tr (
"was not found"));
151 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::addCoordSystems" 152 <<
" toAdd=" << numberCoordSystemToAdd;
155 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";
284 const QPointF &posScreen,
285 const QPointF &posGraph,
287 QString &errorMessage)
289 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::checkEditPointAxis";
300 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::coordSystem";
307 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::coordSystemCount";
314 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::coordSystemIndex";
321 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::curveAxes";
328 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::curveForCurveName";
335 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::curveForCurveName";
342 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::curvesGraphs";
349 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::curvesGraphsNames";
356 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::curvesGraphsNumPoints";
363 return m_documentAxesPointsRequired;
367 const QString &identifier)
369 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::editPointAxis";
379 const QStringList &identifiers,
382 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::editPointCurve";
392 void Document::generateEmptyPixmap(
const QXmlStreamAttributes &attributes)
394 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::generateEmptyPixmap";
396 int width = 800, height = 500;
398 if (attributes.hasAttribute (DOCUMENT_SERIALIZE_IMAGE_WIDTH) &&
399 attributes.hasAttribute (DOCUMENT_SERIALIZE_IMAGE_HEIGHT)) {
401 width = attributes.value (DOCUMENT_SERIALIZE_IMAGE_WIDTH).toInt();
402 height = attributes.value (DOCUMENT_SERIALIZE_IMAGE_HEIGHT).toInt();
406 m_pixmap = QPixmap (width, height);
411 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::initializeGridDisplay";
418 Functor2wRet<const QString &, const Point &, CallbackSearchReturn> ftorWithCallback = functor_ret (ftor,
425 QRectF boundingRectGraph = ftor.boundingRectGraph(isEmpty);
441 return m_coordSystemContext.
isXOnly (pointIdentifier);
446 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::iterateThroughCurvePointsAxes";
453 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::iterateThroughCurvePointsAxes";
459 const Functor2wRet<const Point &, const Point &, CallbackSearchReturn> &ftorWithCallback)
const 461 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::iterateThroughCurveSegments";
469 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::iterateThroughCurvesPointsGraphs";
476 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::iterateThroughCurvesPointsGraphs";
481 void Document::loadImage(QXmlStreamReader &reader)
483 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::loadImage";
485 loadNextFromReader(reader);
486 if (reader.isCDATA ()) {
489 QByteArray array64 = reader.text().toString().toUtf8();
493 array = QByteArray::fromBase64(array64);
496 QDataStream str (&array, QIODevice::ReadOnly);
497 QImage img = m_pixmap.toImage ();
499 m_pixmap = QPixmap::fromImage (img);
502 while ((reader.tokenType() != QXmlStreamReader::EndElement) ||
503 (reader.name() != DOCUMENT_SERIALIZE_IMAGE)){
504 loadNextFromReader(reader);
512 reader.raiseError (QObject::tr (
"Cannot read image data"));
516 void Document::loadPreVersion6 (QDataStream &str)
518 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::loadPreVersion6";
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;
547 NOMINAL_COORD_SYSTEM_COUNT);
551 bool inDocumentSubtree =
false;
554 while (!reader.atEnd() &&
555 !reader.hasError()) {
556 QXmlStreamReader::TokenType tokenType = loadNextFromReader(reader);
559 if ((reader.name() == DOCUMENT_SERIALIZE_IMAGE) &&
560 (tokenType == QXmlStreamReader::StartElement)) {
562 generateEmptyPixmap (reader.attributes());
566 if ((reader.name() == DOCUMENT_SERIALIZE_DOCUMENT) &&
567 (tokenType == QXmlStreamReader::StartElement)) {
569 inDocumentSubtree =
true;
571 }
else if ((reader.name() == DOCUMENT_SERIALIZE_DOCUMENT) &&
572 (tokenType == QXmlStreamReader::EndElement)) {
578 if (inDocumentSubtree) {
581 if (tokenType == QXmlStreamReader::StartElement) {
584 QString tag = reader.name().toString();
585 if (tag == DOCUMENT_SERIALIZE_IMAGE) {
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) {
660 ONE_COORDINATE_SYSTEM);
662 m_documentAxesPointsRequired);
663 }
else if (tag == DOCUMENT_SERIALIZE_IMAGE) {
670 if (reader.hasError ()) {
672 m_successfulRead =
false;
673 m_reasonForUnsuccessfulRead = reader.errorString();
681 LOG4CPP_DEBUG_S ((*mainCat)) <<
"Document::modelAxesChecker";
688 LOG4CPP_DEBUG_S ((*mainCat)) <<
"Document::modelColorFilter";
695 LOG4CPP_DEBUG_S ((*mainCat)) <<
"Document::modelCoords";
702 LOG4CPP_DEBUG_S ((*mainCat)) <<
"Document::modelCurveStyles";
709 LOG4CPP_DEBUG_S ((*mainCat)) <<
"Document::modelDigitizeCurve";
716 LOG4CPP_DEBUG_S ((*mainCat)) <<
"Document::modelExport";
723 LOG4CPP_DEBUG_S ((*mainCat)) <<
"Document::modelGeneral";
730 LOG4CPP_DEBUG_S ((*mainCat)) <<
"Document::modelGridDisplay";
737 LOG4CPP_DEBUG_S ((*mainCat)) <<
"Document::modelGridRemoval";
744 LOG4CPP_DEBUG_S ((*mainCat)) <<
"Document::modelPointMatch";
751 LOG4CPP_DEBUG_S ((*mainCat)) <<
"Document::modelSegments";
757 const QPointF &deltaScreen)
759 m_coordSystemContext.
movePoint (pointIdentifier,
765 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::nextOrdinalForCurve";
770 void Document::overrideGraphDefaultsWithMapDefaults ()
772 const int DEFAULT_WIDTH = 1;
781 pointStyle.
setShape (POINT_SHAPE_CIRCLE);
797 QStringList::const_iterator itr;
798 for (itr = curveNames.begin(); itr != curveNames.end(); itr++) {
799 QString curveName = *itr;
833 QTextStream str (&text);
837 std::cerr << text.toLatin1().data();
841 QTextStream &str)
const 843 str << indentation <<
"Document\n";
845 indentation += INDENTATION_DELTA;
847 str << indentation <<
"name=" << m_name <<
"\n";
848 str << indentation <<
"pixmap=" << m_pixmap.width() <<
"x" << m_pixmap.height() <<
"\n";
856 ENGAUGE_ASSERT (!m_successfulRead);
858 return m_reasonForUnsuccessfulRead;
863 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::removePointAxis";
870 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::removePointGraph";
877 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::removePointsInCurvesGraphs";
884 writer.writeStartElement(DOCUMENT_SERIALIZE_DOCUMENT);
888 writer.writeAttribute(DOCUMENT_SERIALIZE_APPLICATION_VERSION_NUMBER, VERSION_NUMBER);
891 writer.writeAttribute(DOCUMENT_SERIALIZE_AXES_POINTS_REQUIRED, QString::number (m_documentAxesPointsRequired));
895 QDataStream str (&array, QIODevice::WriteOnly);
896 QImage img = m_pixmap.toImage ();
898 writer.writeStartElement(DOCUMENT_SERIALIZE_IMAGE);
902 writer.writeAttribute(DOCUMENT_SERIALIZE_IMAGE_WIDTH, QString::number (img.width()));
903 writer.writeAttribute(DOCUMENT_SERIALIZE_IMAGE_HEIGHT, QString::number (img.height()));
905 writer.writeCDATA (array.toBase64 ());
906 writer.writeEndElement();
908 m_coordSystemContext.
saveXml (writer);
918 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setCoordSystemIndex";
925 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setCurveAxes";
932 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setCurvesGraphs";
939 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setDocumentAxesPointsRequired";
943 if (documentAxesPointsRequired == DOCUMENT_AXES_POINTS_REQUIRED_2) {
945 overrideGraphDefaultsWithMapDefaults ();
951 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setModelAxesChecker";
958 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setModelColorFilter";
961 ColorFilterSettingsList::const_iterator itr;
966 QString curveName = itr.key();
976 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setModelCoords";
983 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setModelCurveStyles";
986 QStringList curveNames = modelCurveStyles.
curveNames();
987 QStringList::iterator itr;
988 for (itr = curveNames.begin(); itr != curveNames.end(); itr++) {
990 QString curveName = *itr;
1000 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setModelDigitizeCurve";
1007 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setModelExport";
1014 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setModelGeneral";
1021 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setModelGridDisplay";
1028 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setModelGridRemoval";
1035 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setModelPointMatch";
1042 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setModelSegments";
1049 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::setPixmap";
1051 m_pixmap = QPixmap::fromImage (image);
1061 return m_successfulRead;
1066 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::updatePointOrdinals";
1071 int Document::versionFromFile (QFile *file)
const 1073 LOG4CPP_INFO_S ((*mainCat)) <<
"Document::versionFromFile";
1075 int version = VERSION_6;
1078 if (doc.setContent (file)) {
1080 QDomNodeList nodes = doc.elementsByTagName (DOCUMENT_SERIALIZE_DOCUMENT);
1081 if (nodes.count() > 0) {
1082 QDomNode node = nodes.at (0);
1084 QDomNamedNodeMap attributes = node.attributes();
1086 if (attributes.contains (DOCUMENT_SERIALIZE_APPLICATION_VERSION_NUMBER)) {
1088 QDomElement elem = node.toElement();
1089 version = (int) elem.attribute (DOCUMENT_SERIALIZE_APPLICATION_VERSION_NUMBER).toDouble();
void addCoordSystems(unsigned int numberCoordSystemToAdd)
Add some number (0 or more) of additional coordinate systems.
void addCoordSystems(DocumentAxesPointsRequired documentAxesPointsRequired, unsigned int numberCoordSystemToAdd)
Add specified number of coordinate systems to the original one created by the constructor.
void addGraphCurveAtEnd(const QString &curveName)
Add new graph curve to the list of existing graph curves.
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.
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.
virtual void checkEditPointAxis(const QString &pointIdentifier, const QPointF &posScreen, const QPointF &posGraph, bool &isError, QString &errorMessage)
Check before calling editPointAxis.
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...
virtual DocumentAxesPointsRequired documentAxesPointsRequired() const
Number of axes points for map or graph. This value is returned after opening a file.
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.
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.
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...
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 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.
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 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.
void loadPreVersion6(QDataStream &str, double version)
Load from file in pre-version 6 format.
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...
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 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.
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 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.