Engauge Digitizer  2
GraphicsLinesForCurve.h
1 /******************************************************************************************************
2  * (C) 2014 markummitchell@github.com. This file is part of Engauge Digitizer, which is released *
3  * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file *
4  * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. *
5  ******************************************************************************************************/
6 
7 #ifndef GRAPHICS_LINES_FOR_CURVE_H
8 #define GRAPHICS_LINES_FOR_CURVE_H
9 
10 #include "Point.h"
11 #include "OrdinalToGraphicsPoint.h"
12 #include <QGraphicsPathItem>
13 
14 class CurveStyle;
15 class GeometryWindow;
16 class GraphicsPoint;
17 class GraphicsScene;
18 class LineStyle;
19 class PointStyle;
20 class QTestStream;
21 class Transformation;
22 
25 class GraphicsLinesForCurve : public QGraphicsPathItem
26 {
27 public:
29  GraphicsLinesForCurve(const QString &curveName);
31 
36  void addPoint (const QString &pointIdentifier,
37  double ordinal,
38  GraphicsPoint &point);
39 
41  double identifierToOrdinal (const QString &identifier) const;
42 
44  void lineMembershipPurge (const LineStyle &lineStyle);
45 
47  void lineMembershipReset ();
48 
50  void printStream (QString indentation,
51  QTextStream &str) const;
52 
54  void removePoint (double ordinal);
55 
59 
61  void updateAfterCommand (GraphicsScene &scene,
62  const PointStyle &pointStyle,
63  const Point &point,
64  GeometryWindow *geometryWindow);
65 
67  void updateCurveStyle (const CurveStyle &curveStyle);
68 
71 
73  void updateHighlightOpacity (double highlightOpacity);
74 
76  void updatePointOrdinalsAfterDrag (const LineStyle &lineStyle,
77  const Transformation &transformation);
78 
79 private:
80 
81  QPainterPath drawLinesSmooth ();
82  QPainterPath drawLinesStraight ();
83  bool needOrdinalRenumbering () const; // True if m_graphicsPoints ordinal keys need renumbering
84  void renumberOrdinals(); // Renumbers m_graphicsPoints ordinal keys
85 
86  const QString m_curveName;
87  OrdinalToGraphicsPoint m_graphicsPoints;
88 };
89 
90 #endif // GRAPHICS_LINES_FOR_CURVE_H
void lineMembershipReset()
Mark points as unwanted. Afterwards, lineMembershipPurge gets called.
void updateCurveStyle(const CurveStyle &curveStyle)
Update the curve style for this curve.
Class that represents one digitized point. The screen-to-graph coordinate transformation is always ex...
Definition: Point.h:23
Window that displays the geometry information, as a table, for the current curve. ...
GraphicsLinesForCurve(const QString &curveName)
Single constructor.
void updateGraphicsLinesToMatchGraphicsPoints(const LineStyle &lineStyle)
Calls to moveLinesWithDraggedPoint have finished so update the lines correspondingly.
void updatePointOrdinalsAfterDrag(const LineStyle &lineStyle, const Transformation &transformation)
See GraphicsScene::updateOrdinalsAfterDrag. Pretty much the same steps as Curve::updatePointOrdinals...
This class stores the GraphicsLine objects for one Curve.
Affine transformation between screen and graph coordinates, based on digitized axis points...
Details for a specific Point.
Definition: PointStyle.h:20
void removeTemporaryPointIfExists()
Remove temporary point if it exists.
void printStream(QString indentation, QTextStream &str) const
Debugging method that supports print method of this class and printStream method of some other class(...
void updateHighlightOpacity(double highlightOpacity)
Update the highlight opacity value. This may or may not affect the current display immediately depend...
Container for LineStyle and PointStyle for one Curve.
Definition: CurveStyle.h:18
void updateAfterCommand(GraphicsScene &scene, const PointStyle &pointStyle, const Point &point, GeometryWindow *geometryWindow)
Update the GraphicsScene with the specified Point from the Document. If it does not exist yet in the ...
Details for a specific Line.
Definition: LineStyle.h:19
Graphics item for drawing a circular or polygonal Point.
Definition: GraphicsPoint.h:43
void addPoint(const QString &pointIdentifier, double ordinal, GraphicsPoint &point)
Add new line.
Add point and line handling to generic QGraphicsScene.
Definition: GraphicsScene.h:33
void lineMembershipPurge(const LineStyle &lineStyle)
Mark the end of addPoint calls. Remove stale lines, insert missing lines, and draw the graphics lines...
void removePoint(double ordinal)
Remove the specified point. The act of deleting it will automatically remove it from the GraphicsScen...
double identifierToOrdinal(const QString &identifier) const
Get ordinal for specified identifier.