7 #include "CallbackAddPointsInCurvesGraphs.h" 8 #include "CallbackCheckAddPointAxis.h" 9 #include "CallbackCheckEditPointAxis.h" 10 #include "CallbackNextOrdinal.h" 11 #include "CallbackRemovePointsInCurvesGraphs.h" 12 #include "CoordSystem.h" 14 #include "CurvesGraphs.h" 15 #include "CurveStyles.h" 16 #include "DocumentSerialize.h" 17 #include "EngaugeAssert.h" 18 #include "EnumsToQt.h" 21 #include "OrdinalGenerator.h" 24 #include <QDataStream> 28 #include <QtToString.h> 29 #include <QXmlStreamReader> 30 #include <QXmlStreamWriter> 31 #include "SettingsForGraph.h" 32 #include "Transformation.h" 36 const int FOUR_BYTES = 4;
39 m_curveAxes (new
Curve (AXIS_CURVE_NAME,
44 LOG4CPP_INFO_S ((*mainCat)) <<
"CoordSystem::CoordSystem";
52 DEFAULT_GRAPH_CURVE_NAME);
58 resetSelectedCurveNameIfNecessary ();
62 CoordSystem::~CoordSystem()
74 resetSelectedCurveNameIfNecessary ();
78 const QPointF &posGraph,
83 Point point (AXIS_CURVE_NAME,
92 LOG4CPP_INFO_S ((*mainCat)) <<
"CoordSystem::addPointAxisWithGeneratedIdentifier" 93 <<
" ordinal=" << ordinal
94 <<
" posScreen=" << QPointFToString (posScreen).toLatin1 ().data ()
95 <<
" posGraph=" << QPointFToString (posGraph).toLatin1 ().data ()
96 <<
" identifier=" << identifier.toLatin1 ().data ();
100 const QPointF &posGraph,
101 const QString &identifier,
105 Point point (AXIS_CURVE_NAME,
113 LOG4CPP_INFO_S ((*mainCat)) <<
"CoordSystem::addPointAxisWithSpecifiedIdentifier" 114 <<
" ordinal=" << ordinal
115 <<
" posScreen=" << QPointFToString (posScreen).toLatin1 ().data ()
116 <<
" posGraph=" << QPointFToString (posGraph).toLatin1 ().data ()
117 <<
" identifier=" << identifier.toLatin1 ().data ();
121 const QPointF &posScreen,
125 Point point (curveName,
132 LOG4CPP_INFO_S ((*mainCat)) <<
"CoordSystem::addPointGraphWithGeneratedIdentifier" 133 <<
" ordinal=" << ordinal
134 <<
" posScreen=" << QPointFToString (posScreen).toLatin1 ().data ()
135 <<
" identifier=" << identifier.toLatin1 ().data ();
139 const QPointF &posScreen,
140 const QString &identifier,
143 Point point (curveName,
149 LOG4CPP_INFO_S ((*mainCat)) <<
"CoordSystem::addPointGraphWithSpecifiedIdentifier" 150 <<
" ordinal=" << ordinal
151 <<
" posScreen=" << QPointFToString (posScreen).toLatin1 ().data ()
152 <<
" identifier=" << identifier.toLatin1 ().data ();
159 Functor2wRet<const QString &, const Point &, CallbackSearchReturn> ftorWithCallback = functor_ret (ftor,
165 bool CoordSystem::bytesIndicatePreVersion6 (
const QByteArray &bytes)
const 167 QByteArray preVersion6MagicNumber;
168 preVersion6MagicNumber.resize (FOUR_BYTES);
171 preVersion6MagicNumber[0] =
'\x00';
172 preVersion6MagicNumber[1] =
'\x00';
173 preVersion6MagicNumber[2] =
'\xCA';
174 preVersion6MagicNumber[3] =
'\xFE';
176 return (bytes == preVersion6MagicNumber);
180 const QPointF &posGraph,
182 QString &errorMessage,
184 DocumentAxesPointsRequired documentAxesPointsRequired)
186 LOG4CPP_INFO_S ((*mainCat)) <<
"CoordSystem::checkAddPointAxis" 187 <<
" posScreen=" << QPointFToString (posScreen).toLatin1 ().data ()
188 <<
" posGraph=" << QPointFToString (posGraph).toLatin1 ().data ();
193 documentAxesPointsRequired,
196 Functor2wRet<const QString &, const Point &, CallbackSearchReturn> ftorWithCallback = functor_ret (ftor,
205 const QPointF &posScreen,
206 const QPointF &posGraph,
208 QString &errorMessage,
209 DocumentAxesPointsRequired documentAxesPointsRequired)
211 LOG4CPP_INFO_S ((*mainCat)) <<
"CoordSystem::checkEditPointAxis" 212 <<
" posGraph=" << QPointFToString (posGraph).toLatin1 ().data ();
218 documentAxesPointsRequired);
220 Functor2wRet<const QString &, const Point &, CallbackSearchReturn> ftorWithCallback = functor_ret (ftor,
230 ENGAUGE_CHECK_PTR (m_curveAxes);
237 if (curveName == AXIS_CURVE_NAME) {
250 if (curveName == AXIS_CURVE_NAME) {
263 return m_curvesGraphs;
277 const QString &identifier)
279 LOG4CPP_INFO_S ((*mainCat)) <<
"CoordSystem::editPointAxis" 280 <<
" posGraph=(" << posGraph.x () <<
", " << posGraph.y () <<
") identifier=" 281 <<
" identifier=" << identifier.toLatin1 ().data ();
291 const QStringList &identifiers,
294 LOG4CPP_INFO_S ((*mainCat)) <<
"CoordSystem::editPointGraph posGraph=(" 295 <<
" x=" << (isX ? QString::number (x).toLatin1().data() :
"")
296 <<
" y=" << (isY ? QString::number (y).toLatin1().data() :
"")
297 <<
") identifiers=" << identifiers.join(
" ").toLatin1 ().data ();
307 void CoordSystem::initializeUnsetGridRemovalFromGridDisplay (
double version)
317 if (m_modelGridRemoval.
countX () < 2 ||
318 m_modelGridRemoval.
countY () < 2 ||
319 m_modelGridRemoval.
countX () > 100 ||
320 m_modelGridRemoval.
countY () > 100) {
337 return m_curveAxes->
isXOnly (pointIdentifier);
342 ENGAUGE_CHECK_PTR (m_curveAxes);
349 ENGAUGE_CHECK_PTR (m_curveAxes);
355 const Functor2wRet<const Point &, const Point &, CallbackSearchReturn> &ftorWithCallback)
const 357 if (curveName == AXIS_CURVE_NAME) {
367 ENGAUGE_CHECK_PTR (m_curveAxes);
374 ENGAUGE_CHECK_PTR (m_curveAxes);
381 LOG4CPP_INFO_S ((*mainCat)) <<
"CoordSystem::loadCurvesFile";
388 DocumentAxesPointsRequired &documentAxesPointsRequired)
390 LOG4CPP_INFO_S ((*mainCat)) <<
"CoordSystem::loadPreVersion6";
393 double dbl, radius = 0.0;
401 str >> (
double &) radius;
422 m_modelExport.
setHeader((ExportHeader) int32);
423 if (version >= 5.1) {
425 if (m_modelCoords.
coordsType() == COORDS_TYPE_CARTESIAN) {
429 if (m_modelCoords.
coordsType() == COORDS_TYPE_POLAR) {
480 m_modelGridDisplay.
setDisableX((GridCoordDisable) int32);
482 m_modelGridDisplay.
setDisableY((GridCoordDisable) int32);
496 initializeUnsetGridRemovalFromGridDisplay (version);
538 documentAxesPointsRequired = DOCUMENT_AXES_POINTS_REQUIRED_2;
539 m_curveAxes = curveScaleIn;
544 documentAxesPointsRequired = DOCUMENT_AXES_POINTS_REQUIRED_3;
545 m_curveAxes = curveAxesIn;
551 if (m_curveAxes->
numPoints () >= documentAxesPointsRequired) {
555 resetSelectedCurveNameIfNecessary ();
559 DocumentAxesPointsRequired &documentAxesPointsRequired)
561 LOG4CPP_INFO_S ((*mainCat)) <<
"CoordSystem::loadVersion6";
563 documentAxesPointsRequired = DOCUMENT_AXES_POINTS_REQUIRED_3;
566 while (!reader.atEnd() &&
567 !reader.hasError()) {
568 QXmlStreamReader::TokenType tokenType = loadNextFromReader(reader);
570 if ((reader.name() == DOCUMENT_SERIALIZE_DOCUMENT) &&
571 (tokenType == QXmlStreamReader::EndElement)) {
578 if (tokenType == QXmlStreamReader::StartElement) {
581 QString tag = reader.name().toString();
582 if (tag == DOCUMENT_SERIALIZE_AXES_CHECKER){
583 m_modelAxesChecker.
loadXml (reader);
584 }
else if (tag == DOCUMENT_SERIALIZE_COORDS) {
585 m_modelCoords.
loadXml (reader);
586 }
else if (tag == DOCUMENT_SERIALIZE_CURVE) {
587 m_curveAxes =
new Curve (reader);
588 }
else if (tag == DOCUMENT_SERIALIZE_CURVES_GRAPHS) {
589 m_curvesGraphs.
loadXml (reader);
590 }
else if (tag == DOCUMENT_SERIALIZE_DIGITIZE_CURVE) {
591 m_modelDigitizeCurve.
loadXml (reader);
592 }
else if (tag == DOCUMENT_SERIALIZE_EXPORT) {
593 m_modelExport.
loadXml (reader);
594 }
else if (tag == DOCUMENT_SERIALIZE_GENERAL || tag == DOCUMENT_SERIALIZE_COMMON) {
595 m_modelGeneral.
loadXml (reader);
596 }
else if (tag == DOCUMENT_SERIALIZE_GRID_REMOVAL) {
597 m_modelGridRemoval.
loadXml (reader);
598 }
else if (tag == DOCUMENT_SERIALIZE_IMAGE) {
599 ENGAUGE_ASSERT (
false);
600 }
else if (tag == DOCUMENT_SERIALIZE_POINT_MATCH) {
601 m_modelPointMatch.
loadXml (reader);
602 }
else if (tag == DOCUMENT_SERIALIZE_SEGMENTS) {
603 m_modelSegments.
loadXml (reader);
605 m_successfulRead =
false;
606 m_reasonForUnsuccessfulRead = QString (
"%1 '%2' %3")
607 .arg (QObject::tr (
"Unexpected xml token"))
609 .arg (
"encountered");
615 resetSelectedCurveNameIfNecessary ();
620 LOG4CPP_INFO_S ((*mainCat)) <<
"CoordSystem::loadVersions7AndUp";
623 while (!reader.atEnd() &&
624 !reader.hasError()) {
625 QXmlStreamReader::TokenType tokenType = loadNextFromReader(reader);
627 if ((reader.name() == DOCUMENT_SERIALIZE_COORD_SYSTEM) &&
628 (tokenType == QXmlStreamReader::EndElement)) {
635 if (tokenType == QXmlStreamReader::StartElement) {
638 QString tag = reader.name().toString();
639 if (tag == DOCUMENT_SERIALIZE_AXES_CHECKER){
640 m_modelAxesChecker.
loadXml (reader);
641 }
else if (tag == DOCUMENT_SERIALIZE_COORDS) {
642 m_modelCoords.
loadXml (reader);
643 }
else if (tag == DOCUMENT_SERIALIZE_CURVE) {
644 m_curveAxes =
new Curve (reader);
645 }
else if (tag == DOCUMENT_SERIALIZE_CURVES_GRAPHS) {
646 m_curvesGraphs.
loadXml (reader);
647 }
else if (tag == DOCUMENT_SERIALIZE_DIGITIZE_CURVE) {
648 m_modelDigitizeCurve.
loadXml (reader);
649 }
else if (tag == DOCUMENT_SERIALIZE_EXPORT) {
650 m_modelExport.
loadXml (reader);
651 }
else if (tag == DOCUMENT_SERIALIZE_GENERAL || tag == DOCUMENT_SERIALIZE_COMMON) {
652 m_modelGeneral.
loadXml (reader);
653 }
else if (tag == DOCUMENT_SERIALIZE_GRID_DISPLAY) {
654 m_modelGridDisplay.
loadXml (reader);
655 }
else if (tag == DOCUMENT_SERIALIZE_GRID_REMOVAL) {
656 m_modelGridRemoval.
loadXml (reader);
657 }
else if (tag == DOCUMENT_SERIALIZE_IMAGE) {
658 ENGAUGE_ASSERT (
false);
659 }
else if (tag == DOCUMENT_SERIALIZE_POINT_MATCH) {
660 m_modelPointMatch.
loadXml (reader);
661 }
else if (tag == DOCUMENT_SERIALIZE_SEGMENTS) {
662 m_modelSegments.
loadXml (reader);
664 m_successfulRead =
false;
665 m_reasonForUnsuccessfulRead = QString (
"Unexpected xml token '%1' encountered").arg (tag);
671 resetSelectedCurveNameIfNecessary ();
676 return m_modelAxesChecker;
689 return m_modelCoords;
702 return m_modelDigitizeCurve;
707 return m_modelExport;
712 return m_modelGeneral;
717 return m_modelGridDisplay;
722 return m_modelGridRemoval;
727 return m_modelPointMatch;
732 return m_modelSegments;
736 const QPointF &deltaScreen)
741 ENGAUGE_ASSERT (curve != 0);
750 Functor2wRet<const QString &, const Point &, CallbackSearchReturn> ftorWithCallback = functor_ret (ftor,
753 if (curveName == AXIS_CURVE_NAME) {
781 QTextStream str (&text);
785 std::cerr << text.toLatin1().data();
789 QTextStream &str)
const 791 str << indentation <<
"Graph\n";
793 indentation += INDENTATION_DELTA;
825 ENGAUGE_ASSERT (!m_successfulRead);
827 return m_reasonForUnsuccessfulRead;
832 LOG4CPP_INFO_S ((*mainCat)) <<
"CoordSystem::removePointAxis identifier=" << identifier.toLatin1 ().data ();
839 LOG4CPP_INFO_S ((*mainCat)) <<
"CoordSystem::removePointGraph identifier=" << identifier.toLatin1 ().data ();
848 Functor2wRet<const QString &, const Point &, CallbackSearchReturn> ftorWithCallback = functor_ret (ftor,
854 void CoordSystem::resetSelectedCurveNameIfNecessary ()
856 if (m_selectedCurveName.isEmpty () ||
867 writer.writeStartElement(DOCUMENT_SERIALIZE_COORD_SYSTEM);
870 m_modelGeneral.
saveXml (writer);
871 m_modelCoords.
saveXml (writer);
872 m_modelDigitizeCurve.
saveXml (writer);
873 m_modelExport.
saveXml (writer);
874 m_modelAxesChecker.
saveXml (writer);
875 m_modelGridDisplay.
saveXml (writer);
876 m_modelGridRemoval.
saveXml (writer);
877 m_modelPointMatch.
saveXml (writer);
878 m_modelSegments.
saveXml (writer);
880 m_curvesGraphs.
saveXml (writer);
881 writer.writeEndElement();
886 return m_selectedCurveName;
891 LOG4CPP_INFO_S ((*mainCat)) <<
"CoordSystem::setCurveAxes";
900 LOG4CPP_INFO_S ((*mainCat)) <<
"CoordSystem::setCurvesGraphs";
904 resetSelectedCurveNameIfNecessary ();
915 ColorFilterSettingsList::const_iterator itr;
920 QString curveName = itr.key();
937 QStringList::iterator itr;
938 for (itr = curveNames.begin(); itr != curveNames.end(); itr++) {
940 QString curveName = *itr;
990 return m_successfulRead;
995 LOG4CPP_INFO_S ((*mainCat)) <<
"CoordSystem::updatePointOrdinals";
bool isError() const
True if an error occurred during iteration.
void printStream(QString indentation, QTextStream &str) const
Debugging method that supports print method of this class and printStream method of some other class(...
const ColorFilterSettingsList & colorFilterSettingsList() const
Get method for copying all color filters in one step.
CallbackSearchReturn callback(const QString &curveName, const Point &point)
Callback method.
void removePoint(const QString &identifier)
Perform the opposite of addPointAtEnd.
Manage storage and retrieval of the settings for the curves.
Model for DlgSettingsGeneral and CmdSettingsGeneral.
CurveStyle curveStyle(const QString &curveName) const
CurveStyle in specified curve.
static QString curveNameFromPointIdentifier(const QString &pointIdentifier)
Parse the curve name from the specified point identifier. This does the opposite of uniqueIdentifierG...
void printStream(QString indentation, QTextStream &str) const
Debugging method that supports print method of this class and printStream method of some other class(...
virtual void saveXml(QXmlStreamWriter &writer) const
Save entire model as xml into stream.
void setStartX(double startX)
Set method for x grid line lower bound (inclusive).
Model for DlgSettingsPointMatch and CmdSettingsPointMatch.
Callback for computing the next ordinal for a new point.
Color filter parameters for one curve. For a class, this is handled the same as LineStyle and PointSt...
static LineStyle defaultGraphCurve(int index)
Initial default for index'th graph curve.
Model for DlgSettingsGridDisplay and CmdSettingsGridDisplay.
int curvesGraphsNumPoints(const QString &curveName) const
Point count.
void loadXml(QXmlStreamReader &reader)
Load from serialized xml post-version 5 file.
virtual void setModelAxesChecker(const DocumentModelAxesChecker &modelAxesChecker)
Set method for DocumentModelAxesChecker.
virtual void printStream(QString indentation, QTextStream &str) const
Debugging method that supports print method of this class and printStream method of some other class(...
Callback that is used when iterating through a read-only CurvesGraphs to remove corresponding points ...
void setCurveStyle(const CurveStyle &curveStyle)
Set curve style.
void setCloseDistance(double closeDistance)
Set method for close distance.
void setLineColor(ColorPalette lineColor)
Set method for line color.
void setCountY(unsigned int countY)
Set method for y grid line count.
int countY() const
Get method for y count.
void setStepX(double stepX)
Set method for x grid line increment.
virtual DocumentModelGridRemoval modelGridRemoval() const
Get method for DocumentModelGridRemoval.
QStringList curveNames() const
List of all curve names.
void printStream(QString indentation, QTextStream &str) const
Debugging method that supports print method of this class and printStream method of some other class(...
Model for DlgSettingsCurveProperties and CmdSettingsCurveProperties.
void setCountX(int countX)
Set method for x count.
void setModelPointMatch(const DocumentModelPointMatch &modelPointMatch)
Set method for DocumentModelPointMatch.
void iterateThroughCurvePoints(const Functor2wRet< const QString &, const Point &, CallbackSearchReturn > &ftorWithCallback) const
Apply functor to Points on Curve.
void setMinLength(double minLength)
Set method for min length.
virtual DocumentModelGridDisplay modelGridDisplay() const
Get method for DocumentModelGridDisplay.
virtual void saveXml(QXmlStreamWriter &writer) const
Save entire model as xml into stream.
unsigned int countX() const
Get method for x grid line count.
virtual const CurvesGraphs & curvesGraphs() const
Make all Curves available, read only, for CmdAbstract classes only.
virtual QString reasonForUnsuccessfulRead() const
Return an informative text message explaining why startup loading failed. Applies if successfulRead r...
void setColorFilterSettings(const ColorFilterSettings &colorFilterSettings)
Set color filter.
virtual void loadXml(QXmlStreamReader &reader)
Load model from serialized xml.
void setPaletteColorCandidate(ColorPalette paletteColorCandidate)
Set method for candidate color.
virtual void setModelGridDisplay(const DocumentModelGridDisplay &modelGridDisplay)
Set method for DocumentModelGridDisplay.
QString errorMessage() const
Error message that explains the problem indicated by isError.
void setStopY(double stopY)
Set method for y stop.
virtual void loadXml(QXmlStreamReader &reader)
Load model from serialized xml.
virtual DocumentModelPointMatch modelPointMatch() const
Get method for DocumentModelPointMatch.
virtual void saveXml(QXmlStreamWriter &writer) const
Save entire model as xml into stream.
Curve * curveForCurveName(const QString &curveName)
Return the axis or graph curve for the specified curve name.
void loadVersions7AndUp(QXmlStreamReader &reader)
Load from file in versions 7 and 8 formats. Number of axes points is already defined at Document leve...
virtual bool successfulRead() const
Return true if startup loading succeeded. If the loading failed then reasonForUnsuccessfulRed will ex...
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...
QPointF positionScreen(const QString &pointIdentifier) const
Return the position, in screen coordinates, of the specified Point.
void setCoordScaleYRadius(CoordScale coordScale)
Set method for linear/log scale on y/radius.
Callback that is used when iterating through a read-only CurvesGraphs to add corresponding points in ...
virtual void updatePointOrdinals(const Transformation &transformation)
Update point ordinals after point addition/removal or dragging.
void editPointAxis(const QPointF &posGraph, const QString &identifier)
Edit the graph coordinates of an axis point. This method does not apply to a graph point.
virtual void setModelExport(const DocumentModelExportFormat &modelExport)
Set method for DocumentModelExportFormat.
virtual void saveXml(QXmlStreamWriter &writer) const
Save entire model as xml into stream.
void iterateThroughCurvesPoints(const Functor2wRet< const QString &, const Point &, CallbackSearchReturn > &ftorWithCallback)
Apply functor to Points on all of the Curves.
virtual QStringList curvesGraphsNames() const
See CurvesGraphs::curvesGraphsNames.
void setStartY(double startY)
Set method for y start.
void setStepY(double stepY)
Set method for y step.
Class that represents one digitized point. The screen-to-graph coordinate transformation is always ex...
void addGraphCurveAtEnd(const Curve &curve)
Append new graph Curve to end of Curve list.
void setStepY(double yStep)
Set method for y grid line increment.
virtual void loadXml(QXmlStreamReader &reader)
Load model from serialized xml.
bool isXOnly(const QString &pointIdentifier) const
Return true if y coordinate is undefined, otherwise x coordinae is undefined in DOCUMENT_AXES_POINT_R...
Callback for sanity checking the screen and graph coordinates of an axis point that is in the axes cu...
unsigned int countY() const
Get method for y grid line count.
virtual DocumentModelDigitizeCurve modelDigitizeCurve() const
Get method for DocumentModelDigitizeCurve.
void printStream(QString indentation, QTextStream &str) const
Debugging method that supports print method of this class and printStream method of some other class(...
void setStartX(double startX)
Set method for x start.
virtual void loadXml(QXmlStreamReader &reader)
Load model from serialized xml.
CallbackSearchReturn callback(const QString &curveName, const Point &point)
Callback method.
virtual void setModelSegments(const DocumentModelSegments &modelSegments)
Set method for DocumentModelSegments.
virtual void setModelGridRemoval(const DocumentModelGridRemoval &modelGridRemoval)
Set method for DocumentModelGridRemoval.
void setLineWidth(double lineWidth)
Set method for line width.
int numPoints() const
Number of points.
void editPointGraph(bool isX, bool isY, double x, double y, const QStringList &identifiers, const Transformation &transformation)
Set the x and/or y coordinate values of the specified points.
virtual void loadXml(QXmlStreamReader &reader)
Load model from serialized xml.
virtual void iterateThroughCurveSegments(const QString &curveName, const Functor2wRet< const Point &, const Point &, CallbackSearchReturn > &ftorWithCallback) const
See Curve::iterateThroughCurveSegments, for any axes or graph curve.
void printStream(QString indentation, QTextStream &str) const
Debugging method that supports print method of this class and printStream method of some other class(...
void setCountY(int countY)
Set method for y count.
CoordSystem()
Single constructor.
void movePoint(const QString &pointIdentifier, const QPointF &deltaScreen)
Translate the position of a point by the specified distance vector.
virtual void addPointGraphWithGeneratedIdentifier(const QString &curveName, const QPointF &posScreen, QString &generatedIentifier, double ordinal)
Add a single graph point with a generated point identifier.
static ColorFilterSettings defaultFilter()
Initial default for any Curve.
virtual void loadXml(QXmlStreamReader &reader)
Load model from serialized xml.
virtual int nextOrdinalForCurve(const QString &curveName) const
Default next ordinal value for specified curve.
void setStable(bool stable)
Set method for stable flag.
void saveXml(QXmlStreamWriter &writer) const
Serialize curves.
virtual void setModelGeneral(const DocumentModelGeneral &modelGeneral)
Set method for DocumentModelGeneral.
virtual DocumentModelCoords modelCoords() const
Get method for DocumentModelCoords.
Model for DlgSettingsDigitizeCurve and CmdSettingsDigitizeCurve.
virtual void setCurvesGraphs(const CurvesGraphs &curvesGraphs)
Let CmdAbstract classes overwrite CurvesGraphs. Applies to current coordinate system.
QString identifier() const
Unique identifier for a specific Point.
virtual DocumentModelSegments modelSegments() const
Get method for DocumentModelSegments.
void loadVersion6(QXmlStreamReader &reader, DocumentAxesPointsRequired &documentAxesPointsRequired)
Load from file in version 6 format. Number of axes points is read in and passed to Document.
Details for a specific Point.
void setStepX(double stepX)
Set method for x step.
void setMaxPointSize(double maxPointSize)
Set method for max point size.
void addPoint(const Point &point)
Append new Point to the specified Curve.
Container for all graph curves. The axes point curve is external to this class.
Model for DlgSettingsColorFilter and CmdSettingsColorFilter.
void printStream(QString indentation, QTextStream &str) const
Debugging method that supports print method of this class and printStream method of some other class(...
virtual void saveXml(QXmlStreamWriter &writer) const
Save entire model as xml into stream.
virtual void loadXml(QXmlStreamReader &reader)
Load model from serialized xml.
virtual void setCurveAxes(const Curve &curveAxes)
Let CmdAbstract classes overwrite axes Curve. Applies to current coordinate system.
void setStopX(double stopX)
Set method for x grid line upper bound (inclusive).
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 DocumentModelAxesChecker modelAxesChecker() const
Get method for DocumentModelAxesChecker.
virtual void removePointsInCurvesGraphs(CurvesGraphs &curvesGraphs)
Remove all points identified in the specified CurvesGraphs. See also addPointsInCurvesGraphs.
virtual void saveXml(QXmlStreamWriter &writer) const
Save entire model as xml into stream.
virtual void saveXml(QXmlStreamWriter &writer) const
Save graph to xml.
virtual void loadXml(QXmlStreamReader &reader)
Load model from serialized xml.
virtual void setModelColorFilter(const DocumentModelColorFilter &modelColorFilter)
Set method for DocumentModelColorFilter.
void setCoordUnitsTheta(CoordUnitsPolarTheta coordUnits)
Set method for theta units.
virtual DocumentModelColorFilter modelColorFilter() const
Get method for DocumentModelColorFilter.
void setRemoveDefinedGridLines(bool removeDefinedGridLines)
Set method for removing defined grid lines.
void iterateThroughCurveSegments(const Functor2wRet< const Point &, const Point &, CallbackSearchReturn > &ftorWithCallback) const
Apply functor to successive Points, as line segments, on Curve. This could be a bit slow.
int numCurves() const
Current number of graphs curves.
virtual void removePointGraph(const QString &identifier)
Perform the opposite of addPointGraph.
double stopY() const
Get method for y grid line upper bound (inclusive).
void setCurveName(const QString &curveName)
Change the curve name.
void setDisableX(GridCoordDisable disableX)
Set method for x grid line disabled variable.
double stopX() const
Get method for x grid line upper bound (inclusive).
void setStopY(double yStop)
Set method for y grid line upper bound (inclusive).
CallbackSearchReturn callback(const QString &curveName, const Point &point)
Callback method.
Model for DlgSettingsCoords and CmdSettingsCoords.
Container for LineStyle and PointStyle for one Curve.
void setOriginRadius(double originRadius)
Set method for origin radius in polar mode.
void setGridCoordDisableY(GridCoordDisable gridCoordDisable)
Set method for y coord parameter to disable.
void setDisableY(GridCoordDisable disableY)
Set method for y grid line disabled variable.
Container for one set of digitized Points.
void updatePointOrdinals(const Transformation &transformation)
Update point ordinals to be consistent with their CurveStyle and x/theta coordinate.
Details for a specific Line.
virtual QPointF positionGraph(const QString &pointIdentifier) const
See Curve::positionGraph.
void iterateThroughCurveSegments(const QString &curveNameWanted, const Functor2wRet< const Point &, const Point &, CallbackSearchReturn > &ftorWithCallback) const
Apply functor to segments on the specified axis or graph Curve.
double startY() const
Get method for y grid line lower bound (inclusive).
int numberOfCurvesForImport() const
Return the number of curve names to be generated. Value is maximum of 1 and the number in the configu...
void setCoordUnitsRadius(CoordUnitsNonPolarTheta coordUnits)
Set method for radius units.
void setGridCoordDisableX(GridCoordDisable gridCoordDisable)
Set method for x coord parameter to disable.
QPointF positionGraph(const QString &pointIdentifier) const
Return the position, in graph coordinates, of the specified Point.
void loadPreVersion6(QDataStream &str, double version, DocumentAxesPointsRequired &documentAxesPointsRequired)
Load from file in pre-version 6 format. Number of axes points is read in and passed to Document.
void setPaletteColorRejected(ColorPalette paletteColorRejected)
Set method for rejected color.
virtual void checkEditPointAxis(const QString &pointIdentifier, const QPointF &posScreen, const QPointF &posGraph, bool &isError, QString &errorMessage, DocumentAxesPointsRequired documentAxesPointsRequired)
Check before calling editPointAxis.
virtual Curve * curveForCurveName(const QString &curveName)
See CurvesGraphs::curveForCurveName, although this also works for AXIS_CURVE_NAME.
void setCountX(unsigned int countX)
Set method for x grid line count.
QStringList curvesGraphsNames() const
List of graph curve names.
void setStartY(double yStart)
Set method for y grid line lower bound (inclusive).
virtual void removePointAxis(const QString &identifier)
Perform the opposite of addPointAxis.
Model for DlgSettingsAxesChecker and CmdSettingsAxesChecker.
virtual void addGraphCurveAtEnd(const QString &curveName)
Add new graph curve to the list of existing graph curves.
virtual QPointF positionScreen(const QString &pointIdentifier) const
See Curve::positionScreen.
int countX() const
Get method for x count.
void printStream(QString indentation, QTextStream &str) const
Debugging method that supports print method of this class and printStream method of some other class(...
void setStable()
Set the stable flag to true. This public version has no argument since it cannot be undone.
CoordsType coordsType() const
Get method for coordinates type.
virtual bool loadCurvesFile(const QString &curvesFile)
Load the curve names in the specified Engauge file into the current graph. This is called near the en...
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 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 print() const
Debugging method for printing directly from symbolic debugger.
void addPoint(const Point &point)
Add Point to this Curve.
void printStream(QString indentation, QTextStream &str) const
Debugging method that supports print method of this class and printStream method of some other class(...
virtual void movePoint(const QString &pointIdentifier, const QPointF &deltaScreen)
See Curve::movePoint.
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 DocumentModelGeneral modelGeneral() const
Get method for DocumentModelGeneral.
virtual void addPointsInCurvesGraphs(CurvesGraphs &curvesGraphs)
Add all points identified in the specified CurvesGraphs. See also removePointsInCurvesGraphs.
virtual void iterateThroughCurvesPointsGraphs(const Functor2wRet< const QString &, const Point &, CallbackSearchReturn > &ftorWithCallback)
See Curve::iterateThroughCurvePoints, for all the graphs curves.
Model for DlgSettingsSegments and CmdSettingsSegments.
virtual DocumentModelExportFormat modelExport() const
Get method for DocumentModelExportFormat.
double nextOrdinal() const
Computed next ordinal.
void loadPreVersion6(QDataStream &str)
Load from serialized binary pre-version 6 file.
void printStream(QString indentation, QTextStream &str) const
Debugging method that supports print method of this class and printStream method of some other class(...
virtual int curvesGraphsNumPoints(const QString &curveName) const
See CurvesGraphs::curvesGraphsNumPoints.
double stepY() const
Get method for y grid line increment.
Callback for sanity checking the screen and graph coordinates of an axis point, before it is added to...
double startX() const
Get method for x grid line lower bound (inclusive).
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 saveXml(QXmlStreamWriter &writer) const
Serialize curve.
virtual void saveXml(QXmlStreamWriter &writer) const
Save entire model as xml into stream.
virtual void setModelCurveStyles(const CurveStyles &modelCurveStyles)
Set method for CurveStyles.
virtual void setSelectedCurveName(const QString &selectedCurveName)
Save curve name that is selected for the current coordinate system, for the next time the coordinate ...
virtual CurveStyles modelCurveStyles() const
Get method for CurveStyles.
void removePoint(const QString &pointIdentifier)
Remove the Point from its Curve.
QString errorMessage() const
Error message that explains the problem indicated by isError.
virtual const Curve & curveAxes() const
Get method for axis curve.
Model for DlgSettingsGridRemoval and CmdSettingsGridRemoval. The settings are unstable until the user...
virtual QString selectedCurveName() const
Currently selected curve name. This is used to set the selected curve combobox in MainWindow.
bool isError() const
True if an error occurred during iteration.
bool isXOnly(const QString &pointIdentifier) const
Determine if specified point has just x coordinate. Otherwise has just y coordinate,...
static PointStyle defaultGraphCurve(int index)
Initial default for index'th graph curve.
double stepX() const
Get method for x grid line increment.
void setPointSeparation(double pointSeparation)
Set method for point separation.
QString defaultCurveName(int indexOneBased, const QString &defaultName) const
Default graph name for the specified curve index.
void setPaletteColorAccepted(ColorPalette paletteColorAccepted)
Set method for accepted color.
void setStopX(double stopX)
Set method for x stop.
virtual void iterateThroughCurvePointsAxes(const Functor2wRet< const QString &, const Point &, CallbackSearchReturn > &ftorWithCallback)
See Curve::iterateThroughCurvePoints, for the axes curve.
void setCoordScaleXTheta(CoordScale coordScale)
Set method for linear/log scale on x/theta.
virtual void setModelCoords(const DocumentModelCoords &modelCoords)
Set method for DocumentModelCoords.
CallbackSearchReturn callback(const QString &curveName, const Point &point)
Callback method.
void printStream(QString indentation, QTextStream &str) const
Debugging method that supports print method of this class and printStream method of some other class(...
virtual void setModelDigitizeCurve(const DocumentModelDigitizeCurve &modelDigitizeCurve)
Set method for DocumentModelDigitizeCurve.
virtual void saveXml(QXmlStreamWriter &writer) const
Save entire model as xml into stream.
void setCoordsType(CoordsType coordsType)
Set method for coordinates type.